php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36416 XSLT stylesheet can't be processed more
Submitted: 2006-02-16 13:03 UTC Modified: 2006-02-16 13:13 UTC
From: fidanza at uniroma3 dot it Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.1.2 OS: Windows Server 2003
Private report: No CVE-ID: None
 [2006-02-16 13:03 UTC] fidanza at uniroma3 dot it
Description:
------------
A simple xslt stylesheet used on a production website with php 5.0.4 doesn't work more since we installed php 5.1.2.?

Reproduce code:
---------------
PHP code:

public function loadXslFile(filewrapper $xslFile) {
		
	$this->xslDom->load( $xslFile->getFileName() );
	$this->xslProcessor->importStylesheet( $this->xslDom );
				
}

XSLT file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes" omit-xml-declaration="yes" />
<xsl:strip-space elements="*" />
<xsl:param name="current"/>
	<xsl:template match="node[@id=$current]">
			<xsl:if test="not(@id='home')">
				:: <xsl:value-of select="@title" />					
			</xsl:if>
	</xsl:template>
</xsl:stylesheet>

Expected result:
----------------
The XSLT is expected to return the title attribute of a node element which id matches 'current' param value.

Actual result:
--------------
We obtain the message:

XSLTProcessor::importStylesheet() [function.importStylesheet]: Undefined variable

Trying to extend the scope of xsl:param to enclose the whole template will result in:

XSLTProcessor::importStylesheet() [function.importStylesheet]: compilation error: file D:/InetPub/wwwroot/www.uniroma3.it/xml/pagetitle.xsl line 6 element template

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-16 13:09 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2006-02-16 13:13 UTC] chregu@php.net
Not a php issue, but a libxslt "issue". xsltproc brings the 
same error, but variables in matchers are not allowed 
according to the specs, anyway.

See http://www.w3.org/TR/xslt#section-Defining-Template-Rules: 
"It is an error for the value of the match attribute to 
contain a VariableReference"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC