|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2003-09-24 09:13 UTC] sparky_industries at mad dot scientist dot com
 Description:
------------
if i want to xsl:sort the elements of xsl:for-each and set data-type to 'text' (or drop data-type, which is the same), php crashes (windows error-popup)!
Reproduce code:
---------------
XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
   <names>
      <name>hansi</name>
      <name>bergi</name>
      <name>krabi</name>
      <name>tali</name>
   </names>
</root>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	
<xsl:template match="/root">
	<xsl:apply-templates select="names" />
</xsl:template>
<xsl:template match="names">
	<xsl:for-each select="name">
		<xsl:sort select="." order="descending" data-type="text" />
		<xsl:value-of select="." />
		<br />
	</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Expected result:
----------------
tali<br />
krabi<br />
hansi<br />
bergi<br />
Actual result:
--------------
PHP crashes ...
if i exclude the xsl:sort instruction, it works !
it also works, when data-type="number" (this makes no sense here), but if i drop it, or set data-type="text" php crashes
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 20:00:01 2025 UTC | 
according to "php script": i would like to add the php script, but it is totally integrated into a big framework, so it would not make sense to extract a few code-lines. but it works like that: $xml = function-to-generate-xml-document(); // xml-document is both WELLFORMED and VALID, i really checked that! $xsl = implode("", file($xslfile)); $arguments = array ( "/_xml" => $xml, "/_xsl" => $xsl ); $xh = xslt_create(); @xslt_set_base($xh, "file://" . $valid_base); // the base is set to the directory of the xsl_file $xml = @xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $arguments);