[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: different first element in a list
Thank you very much :) I have some doubts: - why there is no need of <xsl:for-each> command? <xsl:for-each select="."> <tr> <td> <xsl:if test="position()=1"> <xsl:text>list:</xsl:text> </xsl:if> </td> <td> <xsl:value-of select="."/> </td> </tr> </xsl:for-each> - why if I use only one template it needs <xsl:for-each> command? Thank you again :) The actual solution follows: ________________________________________________________________________ Xml <?xml version="1.0" ?> <?xml-stylesheet type="text/xsl" href="data.xsl"?> <data> <element>1</element> <element>3</element> <element>2</element> <element>5</element> <element>4</element> </data> ________________________________________________________________________ Xslt <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" encoding="UTF-8" /> <xsl:strip-space elements="*" /> <xsl:template match="/"> <html> <body> <table> <xsl:apply-templates select="data/element"> <xsl:sort select="." data-type="number" /> </xsl:apply-templates> </table> </body> </html> </xsl:template> <xsl:template match="data/element"> <tr> <td> <xsl:if test="position()=1"> <xsl:text>list:</xsl:text> </xsl:if> </td> <td> <xsl:value-of select="."/> </td> </tr> </xsl:template> </xsl:stylesheet> ________________________________________________________________________ Output list: 1 2 3 4 5 ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|