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 53689 - processing-instruction() in apply-templates
processing-instruction() in apply-templates
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2001-04-26 14:03 UTC by rchaillat
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description rchaillat 2001-04-26 14:03:13 UTC
There seems to be a problem with function processing-instruction() in the
"select" attribute of xsl:apply-templates element. This function works fine
with the "match" attribute in xsl:template element.

*** Stylesheet: 

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

<xsl:template match = "/" > 
        <xsl:apply-templates select="//processing-instruction()"/> 
        <xsl:apply-templates select="//comment()"/> 
        <!-- xsl:apply-templates/--> 
</xsl:template> 

<xsl:template match = "processing-instruction()" > 
        <xsl:value-of select = "concat(name(),' : ',.)" /> 
</xsl:template> 

<xsl:template match = "comment()" > 
        <xsl:text>#########################
        </xsl:text> 
                <xsl:value-of select = "." /> 
        <xsl:text>
#########################</xsl:text> 
</xsl:template> 

</xsl:stylesheet> 


*** Xml file:

[rchaillat@pc-1229 modules]$ cat pi-test.xml
<?xml version= "1.0"?>

<a>
        <!-- Commentaire -->
        <?php lines of code ?>
</a>


*** Result :

[rchaillat@pc-1229 modules]$ xsltproc pi-match.xsl pi-test.xml
Error xpath.c:5305: Start of litteral
//processing-instruction()
                         ^
Error xpath.c:7457: Invalid expression
//processing-instruction()
                         ^
<?xml version="1.0"?>
#########################
         Commentaire 
#########################


*** If you use apply-templates without the "select", we can see that the
matching of PI works:

---
<?xml version= "1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

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

<xsl:template match = "processing-instruction()" > 
        <xsl:value-of select = "concat(name(),' : ',.)" /> 
</xsl:template> 
</xsl:stylesheet> 
---
<?xml version="1.0"?>


        php : lines of code 

---

This might be related to libxml since it's an xpath error, but I attribute
it to libxslt since it appears only in this apply-template "select"
context.

Regards,
Renaud
Comment 1 Daniel Veillard 2001-04-26 14:38:16 UTC
right, bug was in xpath.c , I commited the fix in CVS:

orchis:~/XSLT/tests/general -> xsltproc bug-14-.xsl
../docs/bug-14-.xml
<?xml version="1.0"?>
php : lines of code #########################
         Commentaire 
#########################
orchis:~/XSLT/tests/general ->

I will send the diff,

Daniel
Comment 2 Daniel Veillard 2001-05-04 10:43:50 UTC
shipped in 0.9.0

Daniel