@ 2014-06-13T07:59:16Z <?php
$xml = <<<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<resume>
<personal_info>
<birthdate>07/08/1988</birthdate>
</personal_info>
<jobs>
<job>
<company>Radio Shack</company>
<title>Sales Representative</title>
<startdate>01/01/2011</startdate>
<enddate>02/02/2011</enddate>
<duration>1.5yrs</duration>
<sortdate>20110101</sortdate>
</job>
<job>
<company>Radio Shack2</company>
<title>Sales Representative</title>
<startdate>01/01/2013</startdate>
<enddate>02/02/2013</enddate>
<duration>1.5yrs</duration>
<sortdate>20130202</sortdate>
</job>
</jobs>
</resume>
XML;
$xslt = <<<'XSLT'
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My Word Download</h2>
<xsl:for-each select="resume/jobs/job">
<xsl:sort select="sortdate" data-type="number" order="descending" />
<div>
<xsl:value-of select="company" /> - <xsl:value-of select="title"/>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSLT;
$xmlDom = new DOMDocument();
$xmlDom->loadXml($xml);
$xslDom = new DOMDocument();
//$xslDOM->load($xsltFile);
$xslDom->loadXml($xslt);
$processor = new XsltProcessor();
$processor->importStylesheet($xslDom);
echo $processor->transformToXml($xmlDom);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught Error: Class "XsltProcessor" not found in /in/5v5S7:58
Stack trace:
#0 {main}
thrown in /in/5v5S7 on line 58
Process exited with code 255 . Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Fatal error: Uncaught Error: Class 'XsltProcessor' not found in /in/5v5S7:58
Stack trace:
#0 {main}
thrown in /in/5v5S7 on line 58
Process exited with code 255 . Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.28 Fatal error: Class 'XsltProcessor' not found in /in/5v5S7 on line 58
Process exited with code 255 . Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 Parse error: syntax error, unexpected T_SL in /in/5v5S7 on line 3
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected T_SL in /in/5v5S7 on line 3
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/5v5S7 on line 3
Process exited with code 255 . preferences:dark mode live preview
283.03 ms | 401 KiB | 357 Q