Forum Moderators: open
By the way, I am using DOM XML in PHP5 for parsing, it works fine with PHP example files but not with my files.
TEST.XML
--------
<?xml version='1.0' encoding="ISO-8859-1"?>
<freport_loc>Washington</freport_loc>
<freports xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:noNamespaceSchemaLocation='host.xsd'>
<freport id='200603268765427382'>
<title type="text">What a day!</title>
<date type="date">2006-03-26</date>
<editorname type="text">James W</editorname>
<articlecontent type="text">
This is a test test, hope it works.
</articlecontent>
</freport>
<freport id='200603228765394857'>
<title type="text">Nothing works today</title>
<date type="date">2006-03-22</date>
<editorname type="text">Edvin</editorname>
<articlecontent type="text">
Maybe I shall write something, but not today
</articlecontent>
</freport>
TEST.XSL
--------
<?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="html" encoding="ISO-8859-1" />
<xsl:template match="/">
<h2>Style example</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Date</th>
<th>Descriptiontext</th>
</tr>
<xsl:for-each select="freport">
<xsl:sort select="date"/>
<tr>
<td><xsl:value-of select="date"/></td>
<td><xsl:value-of select="articlecontent"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
I need to get out all freport nodes sorted by date.
Hope someone knows the answer, thanks in advance ;)
<parent>
<child></child>
<child></child>
<child>
<another></another>
</child>
</parent>
In XML every tag must have a closing tag, and must be enclosed by a parent tag. Remember, you are creating a hierarchal structure to data.
Lemme take a closer look at your XSL.