RE: Unique question
Thanks to Joerg and Dimitre for your thoughts on my count unique question. After posting my question, I started playing with Saxon and temporary node-sets to solve the problem, and it seems much easier with v1.1: <xsl:for-each select="/groups/group"> <xsl:variable name="indexes"> <xsl:for-each select="*/*[@index!='']"> <xsl:copy> <xsl:value-of select="@index"/> </xsl:copy> </xsl:for-each> </xsl:variable> <xsl:if test="count(*/*[@index!='']) != count($indexes/*[not(.=preceding::*)])"> <!-- ERROR --> </xsl:if> </xsl:for-each> -----Original Message----- Now, when I'm completely awake, I see that the problem was to count the unique "index" attributes ***within a group***. <xsl:key name="kIndex" match="@index" use="concat(generate-id(../../..), '~',.)"/> Then if $x contains the position of the "group", for which we need to know the count of unique "index" attributes, the following XPath expression returns this count: count( /groups/group[$x]/*/*/@index[generate-id() = generate-id(key('kIndex', concat(generate-id(/groups/group[$x]), '~', .) ) ) ] ) XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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