Hi,
I have xml table that has about 1000 rows (<tr>). I am trying to group the rows by a pattern found in the @id attribute.
Code:
<tr id="ctl00_ContentPlaceHolder1_PICList_gridPICList__1_2_1cat" >
The pattern is the 3 characters after "ctl00_ContentPlaceHolder1_PICList_gridPICList __", which is 1_2
I tried:
Code:
<xsl:for-each-group select="//tr" group-by="substring(@id, 47 , 3)">
which provides weird results.
XSLT:
Code:
<xsl:template match="/">
<data>
<xsl:for-each-group select="//tr" group-by="substring(@id, 47 , 3)">
<xsl:comment>
<xsl:value-of select="current-grouping-key()"/>
</xsl:comment>
</xsl:for-each-group>
</data>
</xsl:template>
Outputs:
Code:
<data >
<!---->
<!--_1c-->
<!--_1_-->
</data>
Any suggestions would be appreciated.
Thx