I have an xml file that is attached to an xsl stylesheet. The xsl stylesheet sorts the "person(s)" in order of the numerical value of their "Points". I need to be able to put this as a table element inside my index.php. How can I do that please?
Here is my XML file
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="reverse.xsl"?>
<POSTS>
<PERSON>
<TITLE>#bono</TITLE>
<POINTS>1</POINTS>
</PERSON>
<PERSON>
<TITLE>#justinbieber</TITLE>
<POINTS>1</POINTS>
</PERSON>
<PERSON>
<TITLE>#katiehopkins</TITLE>
<POINTS>1</POINTS>
</PERSON>
<PERSON>
<TITLE>#georgebush</TITLE>
<POINTS>2</POINTS>
</PERSON>
</POSTS>
Which is linked as you can see to this xsl file...
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:template match="/POSTS">
<table>
<xsl:for-each select="PERSON">
<xsl:sort select="POINTS" data-type="number" order="descending"/>
<tr>
<td><xsl:value-of select="TITLE"/></td>
<td><xsl:value-of select="POINTS"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
I need to be able to take this xml file (post transformation by the xsl) and render it as a table on a php page (that has other elements on it too). (The xsl stylesheet sorts the above xml so that the persons are listed from the top of the tree in descending order based on their points)
Many thanks, Lewis
No comments:
Post a Comment