Subject: RE: [xsl] Vertical table display with sort From: Sundar Shanmugasundaram <SSHANMUGASUNDARAM@xxxxxxxxxxxxx> Date: Wed, 30 Apr 2003 15:02:18 +0530 |
<snip> <xsl:for-each select="o/com/hereyougo/*"> </snip> You can't explicitly say the element name hereyougo is the element name. If you go thro the xml file, it can be different element for the next pair. <?xml version="1.0"?> <o> <com> <hereyougo> <first displayposition="4" displayname="raman4">4</first> <second displayposition="1" displayname="raman1">1</second> <third displayposition="3" displayname="raman3">3</third> <fourth displayposition="2" displayname="raman2">2</fourth> </hereyougo> <imaycome> <four displayposition="4" displayname="raman4">22</four> <five displayposition="1" displayname="raman1">33</five> <six displayposition="3" displayname="raman3">44</six> <firvi displayposition="2" displayname="raman2">11</firvi> </imaycome> </com> </o> is the xml file. -----Original Message----- From: Zink, Juergen [mailto:Juergen.Zink@xxxxxxxxxxxxxxxxxxxx] Sent: Wednesday, April 30, 2003 2:40 PM To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' Subject: AW: [xsl] Vertical table display with sort Importance: Low Hi, <snip> I would like to sort the following XML file based on the displayposition. I am printing the value and displayname. <snip> another solution is grouping with key. <!-- grouping with the same displayposition --> <xsl:key name="displayposition" match="*[@displayposition]" use="@displayposition"/> <xsl:template match="/"> <table> <!-- get all possible keyvalues in sorted order --> <xsl:for-each select="o/com/hereyougo/*"> <xsl:sort select="@displayposition"/> <tr> <th><xsl:value-of select="@displayname"/></th> <!-- now process all elements with the same key --> <xsl:for-each select="key('displayposition', @displayposition)" > <td><xsl:value-of select="." /></td> </xsl:for-each> </tr> </xsl:for-each> </table> </xsl:template> Cheers, Juergen **************************************************************************** * Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese eMail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. **************************************************************************** * XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Vertical table display wi, Jarno . Elovirta | Thread | [xsl] Adding line feed using fo, XSL Chatr |
AW: [xsl] Vertical table display wi, Zink, Juergen | Date | [xsl] is this really tough?, Sundar Shanmugasunda |
Month |