-----Original Message-----
From: Michael Kay
> My question was, how does the '/' eliminate duplicates?
> That's the bit I don't understand.
If the input is
> <table name="table1">
> <column name="col1"/>
> <column name="col2"/>
> <column name="col3"/>
> <column name="col4"/>
> </table>
> <table name="table2">
> <column name="col1"/>
> <column name="col2"/>
> <column name="col5"/>
> <column name="col5"/>
> </table>
then when processing col5, count(current-group()) will be 2, but
count(current-group()/parent::table) will be 1, because
both columns in the group have the same parent element.
Thanks Mike. Now I see it.
xslt 2.0 stylesheet below demonstrates it.
regards DaveP
<xsl:variable name="table-count" select="count(/tables/table)"/>
<xsl:template match="tables">
<xsl:for-each-group select="table/column" group-by="@name">
<xsl:if test="count(current-group())=$table-count">
<columnName><xsl:value-of
select="current-grouping-key()"/></columnName>
</xsl:if>
<p><i>count(current-group())<xsl:value-of
select="count(current-group()) "/></i></p>
<p><i>count(current-group())/parent::table <xsl:value-of
select="count(current-group()/parent::table) "/></i></p>
</xsl:for-each-group>
</xsl:template>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--