[Home] [By Thread] [By Date] [Recent Entries]
At 09:15 AM 4/8/2002, you wrote:
I want counting all cols from 1 to 8 and then assigning every number to an id attrribute, idependent from their relative context node. I am trying to assign a parameter and then select this <xsl:value-of select="$datacells" />. Instead of position(), use the number of preceding row or col elements as your basis. Remember that you'll need to add 1 for the current node. Here's your stylesheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>tabelle.xsl</title> </head> <body bgcolor="#cccccc" text="#000000" link="#455fbe" vlink="#455fbe" alink="#FF9900" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" id="output"> <div align="center"> <xsl:apply-templates select="tabelle"/> </div> </body> </html> </xsl:template> <xsl:template match="tabelle"> <table cellpadding="0" cellspacing="0" border="1" align="center"> <xsl:apply-templates select="row"/> </table> </xsl:template> <xsl:template match="row"> <tr> <xsl:attribute name="id"><xsl:number value="count(preceding::row) + 1" format="1"/></xsl:attribute> <xsl:apply-templates select="col"/> </tr> </xsl:template> <xsl:template match="col"> <xsl:param name="datacells" select="count(preceding::col) + 1"/> <td> <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="$datacells"/></xsl:attribute> <xsl:value-of select="."/> </td> </xsl:template> </xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



