|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Copying a portion of a subtree in its entirety including
Mike, > Why am I not getting everything from 'Filter' down and why is it also > returning items within Object2 when I'm only matching on 'Object1'. This > is becoming extremely confusing for me. I'm not sure why you're not getting a full copy of 'Filter', but the reason that you're getting text from within Object2 is due to the way the built-in templates work. The built-in templates give arguably helpful default behaviour: they ensure that templates are applied all the way down the document tree, and they output any text that they find as is. Thus to ensure that templates are *not* applied to Object2 and so on down the hierarchy until you get to the text within it, which is then outputted, you need to override this default behaviour. You can do this in two ways. Firstly, you can give a template that says "when you see an Object2, do nothing" (an empty template): <xsl:template match="Object2" /> Secondly, you can have something that matches a node higher up the hierarchy (e.g. on the root node or document element) that says "only apply templates to Object1": <xsl:template match="Config"> <xsl:apply-templates select="Object1" /> </xsl:template> Of these, the latter is probably better because it stops the XSLT Processor from having to search for templates to apply to Object2 (which can take time). However the former option is sometimes more practical when you want to apply templates to all except one particular thing. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








