W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2010

[XSLT] Nullifying the "current template rule" in xsl:for-each

From: Evan Lenz <evan@evanlenz.net>
Date: Fri, 07 May 2010 17:32:13 -0700
Message-ID: <4BE4B10D.2010601@evanlenz.net>
To: public-qt-comments@w3.org

In a future version, it would be nice to see this restriction relaxed, 
i.e. keep the "current template rule" around even when inside 
<xsl:for-each>. This makes <xsl:next-match/> much more useful (such as 
when duplicating an element in the result that only appears once in the 
source document.)

E.g., given the identity transformation as the default template rule, it 
would be nice to be able to do this:

<xsl:template match="*[@duplicate-me eq 'yes']">
  <xsl:for-each select="1 to @how-many">

This example is simplistic, but I do have a real use case (mapping 
multi-valued HTTP request parameters to a repeating element in an XML 
template). And I've run into this restriction before (when wanting to 
use <xsl:apply-imports/> inside <xsl:for-each>).


Evan Lenz
Lenz Consulting Group, Inc.
+1 (360) 297-0087
Received on Saturday, 8 May 2010 00:32:42 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:42 UTC