This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Displaying grid of elements in table with the position() call for input names?
- To: "Duffey, Kevin" <KDuffey at BUYMEDIA dot com>
- Subject: Re: [xsl] Displaying grid of elements in table with the position() call for input names?
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 8 Mar 2001 09:10:06 +0000
- CC: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <1067BB807B9721429D2B8120699C249C3087D4@Exchange1.buymedia.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Kevin,
> This works fine. But now, I have dilema..I need to display a random
> number of fields horizontally as well. Each row has the same number
> of fields across horizontally. So, the name should be something like
> SomeName_rowNum_colNum. However, since the position() call seems to
> be giving me the row number, what happens when I use it in this
> context..where by I am in the row loop and now building the column
> of fields. Does position() give me the number of fields in the
> current xsl:for-each loop? If so, how can I access the "outer"
> xsl:for-each loops count?
You just need to store it in a variable:
<xsl:for-each select="$rows">
<xsl:variable name="rowNum" select="position()" />
<xsl:for-each select="$cols">
<xsl:variable name="colNum" select="position()" />
<input type="text" name="SomeName_{$rowNum}_{$colNum}" />
</xsl:for-each>
</xsl:for-each>
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list