You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Evgeniy Strokin <ev...@yahoo.com> on 2002/03/27 18:36:18 UTC

xsl:for-each inside another xsl:for-each

 
Hi,

Here is a situation:
I have xsl:for-each inside another xsl:for-each.

<xsl:for-each select="Instrument">

<tr class="grid" onmousemove="this.style.backgroundColor='#F9F9CD'" onmouseout="this.style.backgroundColor='#ffffff'">

<xsl:for-each select="/root/hidden/ProductSummary/Instrument/*">

<td class="grid">

<xsl:value-of select="CUSIP"/>

<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

</td>

</xsl:for-each>

</tr>

</xsl:for-each>

 

But in <xsl:value-of select="CUSIP"/> I want to have CUSIP from first xsl:for-each.

How I can do it?

 

Thanks,

Jenya



---------------------------------
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards�

Re: xsl:for-each inside another xsl:for-each

Posted by Peter Davis <pd...@attbi.com>.
The easiest way is to store the CUSIP in a variable before the second 
for-each is started:

<xsl:for-each select="Instrument">
  <xsl:variable name="CUSIP" select="CUSIP"/>
  
  <tr ...>
    <xsl:for-each select="/root/hidden/ProductSummary/Instrument/*">
      <td class="grid">
        <!-- now get the CUSIP we stored in the variable -->
        <xsl:value-of select="$CUSIP"/>
        
        <!-- here is a better way of doing &nbsp; -->
        <xsl:text>&#160;</xsl:text>
      </td>
    </xsl:for-each>
  </tr>
</xsl:for-each>

On Wednesday 27 March 2002 09:36, Evgeniy Strokin wrote:
> Hi,
>
> Here is a situation:
> I have xsl:for-each inside another xsl:for-each.
>
> <xsl:for-each select="Instrument">
>
> <tr class="grid" onmousemove="this.style.backgroundColor='#F9F9CD'"
> onmouseout="this.style.backgroundColor='#ffffff'">
>
> <xsl:for-each select="/root/hidden/ProductSummary/Instrument/*">
>
> <td class="grid">
>
> <xsl:value-of select="CUSIP"/>
>
> <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
>
> </td>
>
> </xsl:for-each>
>
> </tr>
>
> </xsl:for-each>
>
>
>
> But in <xsl:value-of select="CUSIP"/> I want to have CUSIP from first
> xsl:for-each.
>
> How I can do it?


-- 
Peter Davis
"Nuclear war would really set back cable."
		-- Ted Turner