php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22345 XSL error when evaluating an empty path
Submitted: 2003-02-20 22:15 UTC Modified: 2003-02-21 00:41 UTC
From: reedc at aap dot com dot au Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5CVS-2003-02-20 (dev) OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
21 - 8 = ?
Subscribe to this entry?

 
 [2003-02-20 22:15 UTC] reedc at aap dot com dot au
xslt_process() chucks an undefined (no error text) error when an xpath selection is not found. The result should be empty.

For instance, if you were trying to use this stylesheet:
_________________________________________________________ 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text" omit-xml-declaration="yes"/> 
	<xsl:template match="/">

<xsl:for-each select="peas/porridge/ninedaysold">
<xsl:value-of select="." />
</xsl:for-each>

	</xsl:template>
</xsl:stylesheet>
________________________________________________________

on the following xml:
_________________________________________
<?xml version="1.0" encoding="UTF-8"?>
<peas>
  <porridge>
    <hot>yes</hot>
    <cold>no</cold>
    <inadish>no</inadish>
  </porridge>
</peas>
______________________________________________

The result should be nothing. Instead the process chucks an error.

If you use other XSL selections to find the same thing conditionally, such as xsl:if, the result is the same.

If XML elements are optional, then any file not containing them will cause an error with the current php_xslt.dll

The XML/XSL files that produce an error with PHP5x (latest snap). Have worked fine with the past several interations of PHP 4x.

PHP: 5x
Apache 2
Sablotron: 0.97

Thanks

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-21 00:41 UTC] reedc at aap dot com dot au
This is not an error with XSLT. It is an error with my brain (and code).

Apologies ... and thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC