php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49820 XSLTProcessor returns Error at xsl:variable with comment inside
Submitted: 2009-10-09 13:03 UTC Modified: 2014-12-30 10:41 UTC
Votes:2
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: felixsigl at gmail dot com Assigned:
Status: No Feedback Package: XSLT related
PHP Version: 5.3.0 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-10-09 13:03 UTC] felixsigl at gmail dot com
Description:
------------
I have a lot of XSL files which i want to process with the libxml XSLTProcessor. But the XSLTProcessor returns Error at xsl:variable with a comment inside. I don?t know exactly if this is a bug but i think so.

I know that i should use either a select attribute or child nodes in the variable to define the variable. but shouldn?t comments be ignored in that way?

Reproduce code:
---------------
the variable in the xsl file:

doesnt work!:
<xsl:variable select="1" name="var" >
   <!-- comment -->
</xsl:variable>

works:
<xsl:variable select="1" name="var" />

works too:
<xsl:variable name="var" >
   <!-- comment -->
</xsl:variable>

Expected result:
----------------
transformed XML

Actual result:
--------------
Error 1: compilation error: file file:///C:/Programme/xampp/test01.xsl line 4 element variable Line: 0 Column: 0 Error 1: XSLT-variable: The must be no child nodes, since the attribute 'select' was specified. Line: 0 Column: 0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-10 11:54 UTC] Sjoerd@php.net
Thank you for your bug report.

Can you also reproduce it if you remove the whitespace between the variable tags? In your example, the variable element would have a text child node with some whitespace in it. Technically, this is not allowed since the variable tag should have no content at all.
 [2009-10-10 14:15 UTC] felixsigl at gmail dot com
Hi, 

i have tried:

<xsl:variable select="1" name="var"><!--comment--></xsl:variable>

thus no whitspace

but the same error: XSLT-variable: The must be no child nodes, since the attribute 'select' was specified.
 [2010-02-09 23:50 UTC] wellnhofer at aevum dot de
The second example without whitespace is a bug in libxslt. It's a pretty minor issue, but maybe I'll fix it in libxslt.

Nick
 [2010-02-10 01:04 UTC] wellnhofer at aevum dot de
I had a deeper look at the XSLT spec and it seems the both cases are bugs in libxslt.
 [2010-02-10 01:49 UTC] wellnhofer at aevum dot de
The following commit fixes this bug in libxslt

http://github.com/nwellnhof/libxslt/commit/a73df1cbb57f0e250b9815c6b8ed72bd52cb4f72
 [2013-12-02 11:33 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2013-12-02 11:33 UTC] mike@php.net
So, has this fix been released mainstream?
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC