xsl-list
[Top] [All Lists]

[xsl] Nicer way to change context-node than xsl:for-each ?

2009-12-04 09:25:36
Hi folks,

In a template I want to change the context node to the first child.
Here's the workaround I've found :

<xsl:template match="foo">
  <!-- do things with root -->
  <xsl:for-each select="*[1]">
    <xsl:value-of select="." />
    <!-- do many other things, call templates... -->
  </xsl:for-each>
</xsl:template>

Usually xsl:for-each is used to process a serie of nodes, not only to
change the context. I know I should do an apply-templates and the
corresponding template-match, but that would mean rewrite the entire
xsl so I can't do it (for now).

This solution is ok, but if something like "xsl:with" or "xsl:context"
exists, I'd be glad to know.

Thanks for any help,
Regards
Frederic

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--