[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Tempore 20:20:59, die 02/12/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Karl Stubsjoen <kstubs@xxxxxxxxx>:
Just insert an empty template that matches all non-BLUE elements:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*[@cat != 'BLUE']"/>
</xsl:stylesheet>
(notice that "*[not(@cat='BLUE')]" would not work because the root element (without a 'cat' attribute) would then never be copied, neither would its children)
Re: [xsl] Understanding Identity Transformations
Subject: Re: [xsl] Understanding Identity Transformations From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Sat, 12 Feb 2005 20:34:14 +0100 |
Tempore 20:20:59, die 02/12/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Karl Stubsjoen <kstubs@xxxxxxxxx>:
In the below sample, i'm interested in the "BLUE" categories. I still want to bring back the original XML source but omit everything not "BLUE". See the FOO cat="GREEN", it contains a cat="BLUE"... of course I would not expect to return this element since the parent element cat is "GREEN".
Just insert an empty template that matches all non-BLUE elements:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*[@cat != 'BLUE']"/>
<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>
</xsl:stylesheet>
(notice that "*[not(@cat='BLUE')]" would not work because the root element (without a 'cat' attribute) would then never be copied, neither would its children)
regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Gaudiam omnibus traderat W3C, nec vana fides
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Understanding Identity Tr, Karl Stubsjoen | Thread | Re: [xsl] Understanding Identity Tr, Karl Stubsjoen |
Re: [xsl] Understanding Identity Tr, Karl Stubsjoen | Date | Re: [xsl] Understanding Identity Tr, Karl Stubsjoen |
Month |
Keywords