[xml] libxml2 regression on entities



Hi,

I got a report on the debian BTS about a bug from svn2cl when used
against the latest libxml2. I minimized the testcase to the following:
--------- 8<-------------- test.xsl 
<!DOCTYPE xsl:stylesheet [
 <!ENTITY newl "&#xA;">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:template match="text()[contains(.,'&newl;')]"/>

  <xsl:template match="*">
    <xsl:copy><xsl:apply-templates/></xsl:copy>
  </xsl:template>
</xsl:stylesheet>
--------- 8<-------------- /test.xsl

--------- 8<-------------- test.xml
<?xml version="1.0"?>
<test>
  <test>This is a test</test>
  <test>This_is_a_test
</test>
</test>
--------- 8<-------------- /test.xml

The output with xsltproc running with libxml2 2.7.4 is:
--------- 8<-------------- 2.7.4
<?xml version="1.0"?>
<test><test/><test>This_is_a_test
</test>
</test>
--------- 8<-------------- /2.7.4

With libxml2 2.7.3:
--------- 8<-------------- 2.7.3
<?xml version="1.0"?>
<test><test>This is a test</test><test/></test>
--------- 8<-------------- /2.7.3

The former is obviously wrong.

Replacing &newl; with &#xA; makes it work, which means it is not an
issue with contains().

xsltproc verbose output below for both cases:
--------- 8<-------------- 2.7.4
creating dictionary for stylesheet
reusing dictionary from test.xsl for stylesheet
xsltParseStylesheetProcess : found stylesheet
xsltPrecomputeStylesheet: removing ignorable blank node
xsltCompilePattern : parsing 'text()[contains(.,' ')]'
xsltCompilePattern : parsed text()[contains(.,' ')], default priority
0.500000
added pattern : 'text()[contains(.,' ')]' priority 0.500000
xsltCompilePattern : parsing '*'
xsltCompilePattern : parsed *, default priority -0.500000
added pattern : '*' priority -0.500000
parsed 2 templates
Resolving attribute sets references
Creating sub-dictionary from stylesheet for transformation
Registered 0 modules
reusing transformation dict for output
Registering global variables
Registering global variables from test.xsl
xsltProcessOneNode: no template found for /
xsltProcessOneNode: applying template '*' for test
xsltCopy: node test
xsltApplyTemplates: node: 'test'
xsltApplyTemplates: list of 5 nodes
xsltEvalXPathPredicate: returns 1
xsltProcessOneNode: applying template 'text()[contains(.,' ')]' for text
xsltProcessOneNode: applying template '*' for test
xsltCopy: node test
xsltApplyTemplates: node: 'test'
xsltApplyTemplates: list of 1 nodes
xsltEvalXPathPredicate: returns 1
xsltProcessOneNode: applying template 'text()[contains(.,' ')]' for text
xsltEvalXPathPredicate: returns 1
xsltProcessOneNode: applying template 'text()[contains(.,' ')]' for text
xsltProcessOneNode: applying template '*' for test
xsltCopy: node test
xsltApplyTemplates: node: 'test'
xsltApplyTemplates: list of 1 nodes
xsltEvalXPathPredicate: returns 0
xsltProcessOneNode: no template found for text
xsltDefaultProcessOneNode: copy text This_is_a_test

xsltCopyText: copy text This_is_a_test

xsltEvalXPathPredicate: returns 0
xsltProcessOneNode: no template found for text
xsltDefaultProcessOneNode: copy text 

xsltCopyText: copy text 

freeing transformation dictionary
<?xml version="1.0"?>
<test><test/><test>This_is_a_test
</test>
</test>
freeing dictionary from stylesheet
--------- 8<-------------- /2.7.4

--------- 8<-------------- 2.7.3
creating dictionary for stylesheet
reusing dictionary from test.xsl for stylesheet
xsltParseStylesheetProcess : found stylesheet
xsltPrecomputeStylesheet: removing ignorable blank node
xsltCompilePattern : parsing 'text()[contains(.,'
')]'
xsltCompilePattern : parsed text()[contains(.,'
')], default priority 0.500000
added pattern : 'text()[contains(.,'
')]' priority 0.500000
xsltCompilePattern : parsing '*'
xsltCompilePattern : parsed *, default priority -0.500000
added pattern : '*' priority -0.500000
parsed 2 templates
Resolving attribute sets references
Creating sub-dictionary from stylesheet for transformation
Registered 0 modules
reusing transformation dict for output
Registering global variables
Registering global variables from test.xsl
xsltProcessOneNode: no template found for /
xsltProcessOneNode: applying template '*' for test
xsltCopy: node test
xsltApplyTemplates: node: 'test'
xsltApplyTemplates: list of 5 nodes
xsltEvalXPathPredicate: returns 1
xsltProcessOneNode: applying template 'text()[contains(.,'
')]' for text
xsltProcessOneNode: applying template '*' for test
xsltCopy: node test
xsltApplyTemplates: node: 'test'
xsltApplyTemplates: list of 1 nodes
xsltEvalXPathPredicate: returns 0
xsltProcessOneNode: no template found for text
xsltDefaultProcessOneNode: copy text This is a test
xsltCopyText: copy text This is a test
xsltEvalXPathPredicate: returns 1
xsltProcessOneNode: applying template 'text()[contains(.,'
')]' for text
xsltProcessOneNode: applying template '*' for test
xsltCopy: node test
xsltApplyTemplates: node: 'test'
xsltApplyTemplates: list of 1 nodes
xsltEvalXPathPredicate: returns 1
xsltProcessOneNode: applying template 'text()[contains(.,'
')]' for text
xsltEvalXPathPredicate: returns 1
xsltProcessOneNode: applying template 'text()[contains(.,'
')]' for text
freeing transformation dictionary
<?xml version="1.0"?>
<test><test>This is a test</test><test/></test>
freeing dictionary from stylesheet
--------- 8<-------------- /2.7.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]