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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: reedc at aap dot com dot au
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sun Dec 22 05:01:30 2024 UTC