This shouldn't matter. position() calculates the position of
the current
node within the current node list, which is the list of nodes selected
using <xsl:apply-templates> or <xsl:for-each>. So long as you
select the
nodes to be included using one of those instructions (and not, for
example, by selected a larger set of nodes and then selecting a subset
using xsl:if or xsl:choose) the position() should be set correctly.
Thanks for your answer, Michael. Actually, I'm doing exactly what you
describe: I select a larger set of nodes, then selecting a subset with
xsl:if. So we're back to the original question: is there any way to
alternate the row color given that position() won't help me much?
You can't store anything in XSLT - it's a side-effect-free
language; and
there is no concept of "previous" - it's not a sequential execution
model.
Thanks a bunch! None of the books I looked at spelled that out explicitly.
At least I'm not chasing a chimera any longer.
That shouldn't be necessary. I can't follow your code below
I don't blame you: can't figure out much without seeing the input tree.
should be doing something like:
<xsl:value-of select="name(element[.//*[conditions]][1])"/>
Can you explain more on this? Should "element" stay as such or be replaced
with the real name of the element I'm looking for (which turns out to be
"Sequence"). Also, "conditions" need to contain an "xsl:for-each". Is that
possible?
Many thanks,
Constantin Vasiliu
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list