After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 53923 - select in apply-templates ?
select in apply-templates ?
Status: VERIFIED NOTABUG
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2001-04-30 15:29 UTC by rchaillat
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description rchaillat 2001-04-30 15:29:02 UTC
The select in apply-template element does not seem to find the last
element.

(test files taken from www.zvon.org)

[rchaillat@pc-1229]$ cat apply-select.xsl
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version
= "1.0" > 

<xsl:output method = "text" /> 

<xsl:template match = "/" > 
        <xsl:apply-templates select = "//BBB" /> 
</xsl:template> 

<xsl:template match = "BBB" > 
        <xsl:text>
         BBB[</xsl:text> 
                                                                                   
<xsl:value-of select = "position()" /> 
                                                                                   
<xsl:text >]: </xsl:text> 
                                                                                   
<xsl:value-of select = "." /> 
</xsl:template> 

</xsl:stylesheet> 

[rchaillat@pc-1229]$ cat apply-select.xml
<AAA> 
          <BBB>10 </BBB> 
          <BBB>5 </BBB> 
          <BBB>7 </BBB> 
</AAA>

[rchaillat@pc-1229 .gnobog]$ xsltproc apply-select.xsl apply-select.xml 

         BBB[1]: 10 
         BBB[2]: 5 


* Expected output :

  BBB[1]: 10
  BBB[2]: 5
  BBB[3]: 7

Happy debugging ;-)
Renaud
Comment 1 Daniel Veillard 2001-04-30 19:43:34 UTC
Check taht your shell output didn't covered the last
line of the XSLT output :-)

orchis:~/XSLT/tests/general -> xsltproc bug-20-.xsl
../docs/bug-20-.xml

         BBB[1]: 10 
         BBB[2]: 5 
         BBB[3]: 7 orchis:~/XSLT/tests/general ->

The best way to check if and where something went wrong is to give
the -v flag to xsltproc:

orchis:~/XSLT/tests/general -> xsltproc -v bug-20-.xsl
../docs/bug-20-.xml
xsltParseStylesheetFile : parse bug-20-.xsl
Added namespace: xsl mapped to http://www.w3.org/1999/XSL/Transform
xsltPrecomputeStylesheet: removing ignorable blank node
xsltParseStylesheetProcess : found stylesheet
xsltCompilePattern : parsing '/'
added pattern : '/' priority 0.000000
xsltCompilePattern : parsing 'BBB'
added pattern : 'BBB' priority 0.000000
parsed 2 templates
Initializing keys on ../docs/bug-20-.xml
Evaluating global variables
xsltProcessOneNode: applying template for /
xsltApplyTemplates: node: (null)
xsltApplyTemplates: select //BBB
xsltApplyTemplates: list of 3 nodes
xsltProcessOneNode: applying template for BBB
[etc...]

Daniel