|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to use group by in xsl
I got one xml like this:
--------------------------------------------------------------------------------- <example> <row> <name>Peter</name> <coursename>France</coursename> <tuition>100</tuition> <age>41</age> </row> <row> <name>Mark</name> <coursename>English</coursename> <tuition>200</tuition> <age>33</age> </row> <row> <name>Peter</name> <coursename>Spanish</coursename> <tuition>300</tuition> <age>41</age> </row> <row> <name>Peter</name> <coursename>English</coursename> <tuition>200</tuition> <age>41</age> </row> <row> <name>Mark</name> <coursename>France</coursename> <tuition>100</tuition> <age>33</age> </row> <row> <name>John</name> <coursename>France</coursename> <age>53</age> </row> </example> ----------------------------------------------------------------------- I would like to get the output could be group by name and the age should be older than 40. just like this Peter English France Spanish John France I tyied <xsl:for-each-group> and can't get it work. Any ideaqs. Thanks |
|
#2
|
|||
|
|||
|
The tag is <xsl:for-each>, with select being the attribute corresponding to the elements which will be read, in your case, your for-each tag will probably look like this:
Code:
<xsl:for-each select="example/row"> Hope that helps! Happy coding! ![]() |
|
#3
|
|||
|
|||
|
Thanks for the quick reply. But I need to goup the name for output
|
|
#4
|
|||
|
|||
|
Try this:
<xsl:for-each select="example/row[age > '40']/name"> <xsl:sort select="." /> <xsl:value-of select="." /> </xsl:for-each> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > How to use group by in xsl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|