[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Nicer way to change context-node than xsl:for-each ?
From: Frédéric Schwebel <Fred.Schwebel@xxxxxxxxxxx>
Date: Fri, 4 Dec 2009 15:25:12 +0100
 Nicer way to change context-node than xsl:for-each ?
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... -->

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,

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.