Subject: Re: [xsl] The identity transform and attributes From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 21 Jan 2008 21:38:27 +0000 |
On Mon, Jan 21 2008 17:15:39 +0000, colinpauladams@xxxxxxxxxxxxxx wrote: ... > Here's a version that might be more understandable to a beginner (IMHO): > > <xsl:template match="child::*"> Except that in XSLT 2.0, this could also match a parentless element node. Arguably, you wouldn't want to talk too much about parentless nodes straight away, though in any introductory history of the XSLT standards there's a good chance the concept would be mentioned as one of the things added in XSLT 2.0. Michael Kay's version from this morning is (unsurprisingly) clearer for expressing an XSLT 2.0 identity transform. IMO, trying to cover both XSLT versions at once is counterproductive since it's easy enough to have two version-specific boilerplates that you copy as needed. > <xsl:copy> > <xsl:apply-templates select="attribute::*|child::node()"/> > </xsl:copy> > </xsl:template> > > <xsl:template > match="attribute::*|text()|comment()|processing-instruction()"> Why not 'child::text()', etc., here if it made it more understandable above? > <xsl:copy/> > </xsl:template> Regards, Tony Graham. ====================================================================== Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx http://www.menteithconsulting.com Menteith Consulting Ltd Registered in Ireland - No. 428599 Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland ---------------------------------------------------------------------- Menteith Consulting -- Understanding how markup works ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] The identity transform an, Colin Adams | Thread | Re: [xsl] The identity transform an, Colin Adams |
Re: [xsl] extension to insert XML i, Steven Ericsson-Zeni | Date | [xsl] unparsed-text and analyze-str, Terry Ofner |
Month |