[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Displaying grid of elements in table with the position() call for input names?


Subject: RE: [xsl] Displaying grid of elements in table with the position() call for input names?
From: "Robert Nicholson" <robert@xxxxxxxxxxxx>
Date: Wed, 7 Mar 2001 15:10:27 -0800

Does this help in any way. I looks like it loops over a rows' attributes

	<xsl:for-each select="@*">
      <!--
        select="@*" is shorthand for select="attribute::*",
        in other words all attributes
      -->
        <td><xsl:value-of select="."/></td>
      </xsl:for-each>

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Duffey, Kevin
> Sent: Wednesday, March 07, 2001 2:00 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] Displaying grid of elements in table with the position()
> call for input names?
>
>
> Hi there,
>
> I am looping through X # of rows. In doing so, I give each and every input
> box a name like so:
>
> <input type="text">
>   <xsl:attribute name="name">SomeName_<xsl:value-of
> select="position()"/></xsl:attribute>
> </input>
>
> This way, as the rows are built (displayed), there is a counter for each
> row, (1, 2, 3, etc). So when a form is submitted with multiple rows, I
> simply iterate over the number of rows, and read each request
> parameter like
> so:
>
> for( int cntr = 0; cntr < rows; cntr++ )
> {
>   String SomeName = request.getParameter("SomeName_" + cntr);
>   // do something with the SomeName value
> }
>
>
> 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?
>
> Thanks.
>
>  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