XSLT Access outer loop from inner

N

Newbie

I need to iterate through all the cells in an HTML-like table, e.g.

<for-each select="tr">
<for-each select="td">
Get coordinates of cell here
</for-each>
</for-each>

How can I access my position in the outer loop from within the inner loop?
 
N

Newbie

Newbie said:
I need to iterate through all the cells in an HTML-like table, e.g.
<snip>
How can I access my position in the outer loop from within the inner loop?

Forgot to mention; I can do this with

<for-each select="tr">
<xsl:variable name="outer" select="position" />
<for-each select="td">
Get coordinates of cell here
</for-each>
</for-each>

Is there a direct route, without declaring a variable?
 
M

Martin Honnen

Newbie wrote:

Forgot to mention; I can do this with

<for-each select="tr">
<xsl:variable name="outer" select="position" />
select="position()"
<for-each select="td">
Get coordinates of cell here
</for-each>
</for-each>

Is there a direct route, without declaring a variable?

I think the variable is the way to go with.
 
T

toudidel

in my opinion you should forget about the <xsl:for-each> element because
it's most terrible element. instead of it use <xsl:apply-template> with
<xsl:with-param> if needed

td
 
N

Newbie

toudidel said:
in my opinion you should forget about the <xsl:for-each> element because
it's most terrible element. instead of it use <xsl:apply-template> with
<xsl:with-param> if needed

Why?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top