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

Hello,

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">
    <xsl:next-match/>
  </xsl:for-each>
</xsl:template>

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

-- 
Evan Lenz
Lenz Consulting Group, Inc.
http://lenzconsulting.com
+1 (360) 297-0087

Received on Saturday, 8 May 2010 00:32:42 UTC