[xsl] suggestion: xsl:modified-copy

Subject: [xsl] suggestion: xsl:modified-copy
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 1 Aug 2012 11:07:35 +0100
It's a bit late for 3.0, but perhaps for 3.1... sometimes it would be
useful to have the ability to copy and modify a section of the input
at the point its copied, rather than using an additional moded
identity template and no-op templates.

For example given something like:

<foo>
  <bar/>
  <baz/>
</foo>

and you want to copy the lot to the result except <baz/> you could do:

<xsl:modified-copy select="foo">
  <xsl:except select="baz"/>
</xsl:modified-copy>

if you wanted to add another <baz/> you could do:

<xsl:modified-copy select="foo">
  <xsl:insert-after select="baz">
    <baz/>
  </xsl:insert-after>
</xsl:modified-copy>

Just some thoughts....


-- 
Andrew Welch
http://andrewjwelch.com

Current Thread