I was wondering if there was a way to group by a certain node in xml?
Here is my XML document:
So far I have the following XSL document:
Here is my XML document:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<root type='resources'>
<child>
<modifier>DMPORTLS</modifier>
<url>[URL unfurl="true"]http://www.slashdot.org</url>[/URL]
<category>Test1</category>
<categorydescription>This category will be useful</categorydescription>
<linkdescription>All things tech...</linkdescription>
<displaytext>News for nerds, stuff that matters</displaytext>
<description>All things tech...</description>
<cascadelinks>1</cascadelinks>
</child>
<child>
<modifier>BBCI</modifier>
<url>[URL unfurl="true"]http://www.foo.com</url>[/URL]
<category>foo</category>
<categorydescription>The foobar category</categorydescription>
<linkdescription>This is the BBCI Link</linkdescription>
<displaytext>BBCI Link</displaytext>
<description>This is the BBCI Link</description>
<cascadelinks>1</cascadelinks>
</child>
<child>
<modifier>DMPORTLS</modifier>
<url>foo.com</url>
<category>foo</category>
<categorydescription>The foobar category</categorydescription>
<linkdescription>description</linkdescription>
<displaytext>fooDisplay</displaytext>
<description>description</description>
<cascadelinks>0</cascadelinks>
</child>
</root>
So far I have the following XSL document:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:template match="/">
<table id="removePortal" class="">
<tr>
<td><h2>Please select the category:</h2></td>
</tr>
<tr>
<td>
<select size="7" class="removeLink">
<xsl:attribute name="onchange">
displayRemoveLinkDisplayText('BBCI', this.options[this.selectedIndex].value);
</xsl:attribute>
<xsl:for-each select="root/child">
<xsl:sort select="modifier" order="ascending"/>
<option>
<xsl:attribute name="value">
<xsl:value-of select="category" />
</xsl:attribute>
<xsl:value-of select="category" />
</option>
</xsl:for-each>
</select>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
But is displays some categories twice, is there a way to do this so that it only displays a category once?
Thanks alot,
Jon