Subject: Re: [xsl] How to create a node set that excludes some descendant elements? From: Rush Manbert <rush@xxxxxxxxxxx> Date: Tue, 12 Apr 2005 11:16:07 -0700 |
<xsl:variable name="subset"> <xsl:apply-templates select="a" mode="subset"/> </xsl:variable>
(If I remember correctly, $subset would be worthless to me if I did something like this: <xsl:variable name="subset"> <xsl:value-of select="some XPATH expression" /> <xsl:variable> which I thought generalized to anything of the form: <xsl:variable name="subset"> -- anything here -- </xsl:variable> but that does not appear to be the case!)
The example that you've given suggests that you do actually want to create a new tree that is a selective copy of the original tree. The way to do this is to walk the original tree applying templates. If a node is to be copied into the new tree, you apply the identity template, if it is to be removed, you apply an empty template, and of course you can also have templates that modify selected elements. So it looks something like this:
<xsl:variable name="subset"> <xsl:apply-templates select="a" mode="subset"/> </xsl:variable>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to create a node set , Rush Manbert | Thread | [xsl] XSLT 1.0 Grouping, aspsa |
[xsl] how to translate XML with XHT, Magic Finger | Date | Re: [xsl] How to create a node set , Rush Manbert |
Month |