|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I have an XML document that looks like this:
<NewDataSet> <Table> <Column1ID>1</Column1ID> <Column1>Movies</Column1> <Column2ID>10</Column2ID> <Column2>Mr. Deeds</Column2> <Column3ID>20</Column3ID> <Column3>DVD</Column3> </Table> <Table> <Column1ID>1</Column1ID> <Column1>Movies</Column1> <Column2ID>12</Column2ID> <Column2>Terminator 2</Column2> <Column3ID>20</Column3ID> <Column3>DVD</Column3> </Table> <Table> <Column1ID>2</Column1ID> <Column1>Music</Column1> <Column2ID>13</Column2ID> <Column2>Metallica</Column2> <Column3ID>22</Column3ID> <Column3>CD</Column3> </Table> </NewDataSet> I am trying to build a Treeview out of this xml using XSL. What I want to be able to do is get a distinct count of Column1ID. For the XML provided I would have a total count of 2 (Movies & Music). Does anyone know how I can accomplish this? TIA! Shaggy |
|
#2
|
||||
|
||||
|
There is a function provided by exslt.
The function is called set:distinct. The only parameter is a node-set. The return value of the function is a node-set. It selects a node N if there is no node in NS that has the same string value as N, and that precedes N in document order. |
|
#3
|
|||
|
|||
|
I've never used exslt before.
How would I use this? <xsl:call-template name="set:distinct"> <xsl:with-param name="nodes" select="//NewDataSet/Table/ColumnID1"/> </xsl:call-template> How do I get the count? Seth Last edited by shagg99 : August 12th, 2003 at 10:00 AM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSLT Get Distinct Node Count |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|