Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to obtain the value

Status
Not open for further replies.

metsey

Programmer
Mar 2, 2001
49
US
Is it possible to obtain the value of an attribute in the previous row <TR> of a table while looping in xsl?
Here is sample xml:

<rs:data>
<z:row Position=1 LedgerID=&quot;619568&quot;/>
<z:row Position=2 LedgerID=&quot;649185&quot;/>
<z:row Position=3 LedgerID=&quot;619642&quot;/>
</rs:data>

I would like -while in the for loop at position 2- to get the value of @LedgerID from the previous loop.

Can this be done?




 
Hi,

Code:
<xsl:for-each select=&quot;rs:data/z:row&quot;>
	<xsl:variable name=&quot;pos&quot; select=&quot;position() -1&quot;/>
	Row= <xsl:value-of select=&quot;position()&quot;/> LedgerID= <xsl:value-of select=&quot;ancestor::rs:data/z:row[$pos]/@LedgerID&quot;/><br/>
</xsl:for-each>
Good luck!

Jordi Reineman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top