-
Notifications
You must be signed in to change notification settings - Fork 34
Issue 187 Requests #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 187 Requests #188
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export { XPath, ExprContext } from './xpath'; | ||
| export { Xslt, XsltOptions } from './xslt'; | ||
| export { XmlParser, xmlEscapeText, XDocument, XNode, domDocumentToXDocument } from './dom'; | ||
| export { XmlParser, xmlEscapeText, xmlTransformedText, XDocument, XNode, domDocumentToXDocument } from './dom'; | ||
|
Check warning on line 3 in src/index.ts
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { Xslt, XmlParser } from '../../src/index'; | ||
|
|
||
| describe('Issue #187: Identity transformation adds spaces to comments', () => { | ||
| it('keeps comment content stable across repeated identity transforms', async () => { | ||
| const xslt = new Xslt(); | ||
| const xmlParser = new XmlParser(); | ||
|
|
||
| const xmlInput = '<root><!--1234567890 1234567890--></root>'; | ||
| const stylesheet = xmlParser.xmlParse(`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
| <xsl:template match="/"> | ||
| <xsl:copy-of select="."/> | ||
| </xsl:template> | ||
| </xsl:stylesheet>`); | ||
|
|
||
| const firstInputDoc = xmlParser.xmlParse(xmlInput); | ||
| const firstPass = await xslt.xsltProcess(firstInputDoc, stylesheet); | ||
| expect(firstPass).toBe(xmlInput); | ||
|
|
||
| const secondInputDoc = xmlParser.xmlParse(firstPass); | ||
| const secondPass = await xslt.xsltProcess(secondInputDoc, stylesheet); | ||
| expect(secondPass).toBe(firstPass); | ||
| }); | ||
leonelsanchesdasilva marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| it('keeps empty comments stable across repeated identity transforms', async () => { | ||
| const xslt = new Xslt(); | ||
| const xmlParser = new XmlParser(); | ||
|
|
||
| const xmlInput = '<root><!----></root>'; | ||
| const stylesheet = xmlParser.xmlParse(`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
| <xsl:template match="/"> | ||
| <xsl:copy-of select="."/> | ||
| </xsl:template> | ||
| </xsl:stylesheet>`); | ||
|
|
||
| const firstInputDoc = xmlParser.xmlParse(xmlInput); | ||
| const firstPass = await xslt.xsltProcess(firstInputDoc, stylesheet); | ||
| expect(firstPass).toBe(xmlInput); | ||
|
|
||
| const secondInputDoc = xmlParser.xmlParse(firstPass); | ||
| const secondPass = await xslt.xsltProcess(secondInputDoc, stylesheet); | ||
| expect(secondPass).toBe(firstPass); | ||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.