|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: deep copy and exclude some nodes
Hi Joeri,
> I used
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:copy-of select="*[name() != 'field2']"/>
> <xsl:copy>
>
> But what when i need to remove more fields.
> I tried <xsl:copy-of select="*[name() != 'field1' and name() !=
> 'field2']"/> but is not working.
Strange; I think that should work. You could use:
<xsl:copy-of select="*[not(self::field1 or self::field2)]" />
(it's better to use self::field1 than name() = 'field1' because the
former is namespace-aware), but I think that in this case you should
probably apply templates to all the fields and then have empty
templates that filter out the fields that you don't want.
In other words, have an identity template like:
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
which will do the copying, and then have a template that does nothing
with field1 and field2 elements:
<xsl:template match="field1 | field2" />
Cheers,
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








