Re: [xsl] xsl:for-each table with control over current row's value-of

Subject: Re: [xsl] xsl:for-each table with control over current row's value-of
From: Rick Taylor <taylor@xxxxxxxx>
Date: Wed, 28 May 2003 12:49:28 -0600

You need to provide a sample of the source XML and the applicable part of the XSL. Assuming that you have multiple Level2 elements (that contain the ProdID element) that you want to iterate through the for-each you have should work if the rest of the code is correctly done -- That is you should be able to get the as you say "current" row.

You can also insert the value of the ProdID element into the href attribute using curly braces
<a href="http://munsql01/DCR?SQL=SELECT+*+FROM+DailyView+where+prodDate+=+'5/23/2003'+for+xml+auto,elements&amp;xsl=Prodview.xsl&amp;root=ROOT"&amp;prodID={ProdID}>
<xsl:value-of select="ProdID"/>


At 04:12 PM 5/28/03 +0000, you wrote:
I'm using a FOR-EACH like:

<xsl:for-each select="ROOT/Level1/Level2">

Then building a table by defining columns:

<td><xsl:value-of select="ProdID"><td>
<td><xsl:value-of select="ProdName"><td>
<td><xsl:value-of select="ProdType"><td>

but, I want to hyperlink one of the columns to use an http:// sql query

<a href="http://munsql01/DCR?SQL=SELECT+*+FROM+DailyView+where+prodDate+=+'5/23/2003'+for+xml+auto,elements&amp;xsl=Prodview.xsl&amp;root=ROOT">
<xsl:value-of select="ProdID">

but need to add a variable in the query that uses the current row's ProdID.
Basically somehow add 'and ProdID=<xsl:value-of select="ProdID">'
Into that query.

This leaves me with 2 questions:

1. How do I have more control over the value-of in a for-each per row? When I attempt to test using a variable it always pulls the first row's value and not the row that it is currently in. Is there a way to reference the current row's value and not the first one in the list?

2. Once I have established a way to use the current row's value-of, how would I pass that into the hyperlinked query as an argument, adding the where ProdID=currentrow ProdID?

Any help is most appreciated as this seems to be a general naviagation issue and would seem common, I cannot find reference to this anywhere after extensive searching. I basically need to reference the current rows value instead of the first in the list.

Thank you,
Brian Lewandowski

The new MSN 8: smart spam protection and 2 months FREE*

XSL-List info and archive:

Rick Taylor XML Developer PPDM Association

XSL-List info and archive:

Current Thread