|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How can I select only unique combinations of attr
>Use xsl:for-each-group in XSLT 2.0, or Muenchian grouping in XSLT 1.0 >http://www.jenitennison.com/xslt/grouping I had a look at the link. What I needed was actually a bit simpler than the functionality described there as I only needed the list of unique values not details of the elements with those values. But it did point me in the right direction. If instead of trying to check if the value matches the previous one when processing the sorted elements, which turned out not to be possible, I changed the select in the for-each loop to check that this was the first element in the document that had that set of attribute values as follow. <xsl:template name="getListStyleNames"> <xsl:for-each select="descendant::listitem[not ((../@style = preceding::listitem/../@style) and (@bodystyle = preceding::listitem/@bodystyle) and (@style = preceding::listitem/@style))]"> <xsl:element name="style"> <xsl:value-of select="concat(../@style,@bodystyle,@style)"/> </xsl:element> </xsl:for-each> </xsl:template> This seemed to give the list of unique combinations I was after. Thanks to Michael and Andrew for your help. Thanks, Rob
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








