[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: suggestion: xsl:modified-copy
On 01/08/2012 11:07, Andrew Welch wrote:
We get quite close in XSLT 3.0It'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. <xsl:apply-templates select="foo" mode="m"> <xsl:mode name="m" on-no-match="shallow-copy"/> <xsl:template mode="m" match="baz"/> I would love to be able to write this as <xsl:apply-templates select="foo" on-no-match="shallow-copy"> <xsl:template match="baz"/> </xsl:apply-templates> but there seems to be a "we tried that and it didn't work" reaction to this in the WG.
<xsl:apply-templates select="foo" mode="m"> <xsl:mode name="m" on-no-match="shallow-copy"/> <xsl:template mode="m" match="baz"> <xsl:next-match/> <baz/> </xsl:template> I think it needs a more convincing use case. It's true enough that it's difficult to achieve good performance for an application that wants to make a small change to a large tree; or especially if it wants to make lots of small changes to a large tree in a sequence of passes (so each pass sees the result of the previous passes). There's an optimization challenge there; it's basically a question of finding a good data structure to represent a (tree plus deltas), possibly combined with lazy tree construction. This would be much easier if we didn't have to worry about node identity. I don't think that new language constructs (beyond what we have in XSLT 3.0) would make such a transformation easier to optimize. Michael Kay Saxonica
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|