W
will
I have the following xsl which in effect does a distinct select on the
id element
(ie returns list with no repeating items) on subsequent xml..
xml..
<start>
<test>
<id>32354</id>
<rate>2</rate>
</test>
<test>
<id>32354</id>
<rate>2</rate>
</test>
<test>
<id>32354</id>
<rate>4</rate>
</test>
<test>
<id>32356</id>
<rate>4</rate>
</test>
<test>
<id>32357</id>
<rate>2</rate>
</test>
<test>
<id>32357</id>
<rate>2</rate>
</test>
<test>
<id>32358</id>
<rate>5</rate>
</test>
</start>
and xsl..
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xslutput method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="//test/id[not(node() =
preceding::node())]">
<xsl:sort select="." order="ascending"/>
<xsl:element name="tk_id">
<xsl:value-of select="concat(node(), ', ', ../rate)"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This returns a list of unique id
<?xml version="1.0" encoding="UTF-16"?>
<tk_id>32354, 2</tk_id>
<tk_id>32356, 4</tk_id>
<tk_id>32357, 2</tk_id>
<tk_id>32358, 5</tk_id>
This currently seems to be working.. however now i need a distinct
select over 2 elements.
ie selecting unique combinations of id and rate..
The result i would like to get from the above xml would be something
like..
<?xml version="1.0" encoding="UTF-16"?>
<tk_id>32354, 2</tk_id>
<tk_id>32354, 4</tk_id>
<tk_id>32356, 4</tk_id>
<tk_id>32357, 2</tk_id>
<tk_id>32358, 5</tk_id>
as this is the list of unique id and rate combinations..
Any help appreciated..
Thanks
id element
(ie returns list with no repeating items) on subsequent xml..
xml..
<start>
<test>
<id>32354</id>
<rate>2</rate>
</test>
<test>
<id>32354</id>
<rate>2</rate>
</test>
<test>
<id>32354</id>
<rate>4</rate>
</test>
<test>
<id>32356</id>
<rate>4</rate>
</test>
<test>
<id>32357</id>
<rate>2</rate>
</test>
<test>
<id>32357</id>
<rate>2</rate>
</test>
<test>
<id>32358</id>
<rate>5</rate>
</test>
</start>
and xsl..
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xslutput method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="//test/id[not(node() =
preceding::node())]">
<xsl:sort select="." order="ascending"/>
<xsl:element name="tk_id">
<xsl:value-of select="concat(node(), ', ', ../rate)"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This returns a list of unique id
<?xml version="1.0" encoding="UTF-16"?>
<tk_id>32354, 2</tk_id>
<tk_id>32356, 4</tk_id>
<tk_id>32357, 2</tk_id>
<tk_id>32358, 5</tk_id>
This currently seems to be working.. however now i need a distinct
select over 2 elements.
ie selecting unique combinations of id and rate..
The result i would like to get from the above xml would be something
like..
<?xml version="1.0" encoding="UTF-16"?>
<tk_id>32354, 2</tk_id>
<tk_id>32354, 4</tk_id>
<tk_id>32356, 4</tk_id>
<tk_id>32357, 2</tk_id>
<tk_id>32358, 5</tk_id>
as this is the list of unique id and rate combinations..
Any help appreciated..
Thanks