[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] AW: adressing attributes
ok, I found it myself... <xsl:choose> <xsl:when test="../element[$here+$half]"> <xsl:for-each select="../element[$here+$half]"> <xsl:value-of select="@id"/> </xsl:for-each> </xsl:when> <xsl:otherwise></xsl:otherwise> </xsl:choose> -----Ursprüngliche Nachricht----- Von: Michael Zehrer [mailto:zehrer@xxxxxxxxxxxxxxxxxx] Gesendet: Freitag, 29. Juni 2001 12:31 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Betreff: adressing attributes Thanks to the FAQ I learned howto "Making balanced two-column tables from one-column data", but I also want to list one attribute and really don't know how to address it. This is my XML: <page> <element id="sometext">content</element> ... </page> and my XSL is: <xsl:variable name="t-size" select="count(//element)"/> <xsl:variable name="half" select="ceiling($t-size div 2)"/> <table> <xsl:for-each select="//element[position() <= $half]"> <xsl:variable name="here" select="position()"/> <tr> <td><xsl:value-of select="@id"/></td> <td><xsl:value-of select="."/></td> <td><xsl:value-of select="@id"/></td> <td> <xsl:choose> <xsl:when test="../element[$here+$half]"> <xsl:value-of select="../element[$here+$half]"/> </xsl:when> <xsl:otherwise></xsl:otherwise> </xsl:choose> </td> </tr> </xsl:for-each> </table> Sure, at the moment the @id in the 3rd cell gives the same value as the one in the first cell, but it should contain the value of the id attribute of the 4th cell element. I tried to construct something similar to the 4th cell xsl code, but it just don't work. Can someone explain it to me? XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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
|