Re: [xsl] Newbie Question: Filtering Elements out of a Collection

Subject: Re: [xsl] Newbie Question: Filtering Elements out of a Collection
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Tue, 22 Jan 2002 20:58:45 +0100
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="shapeCollection">
    <shapeCollection>
        <xsl:copy-of select="shapeSet[not(ellipse)]"/>
    </shapeCollection>
</xsl:template>

</xsl:stylesheet>

the output:

<shapeCollection>
    <shapeSet id="ID02">
        <circle />
        <square />
    </shapeSet>
    <shapeSet id="ID04">
        <circle />
        <octagon />
    </shapeSet>
</shapeCollection>

Hope this helps,

Joerg

----- Original Message -----
From: "Jeremy E. Denton" <jdenton@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, January 22, 2002 8:27 PM
Subject: [xsl] Newbie Question: Filtering Elements out of a Collection


>
> I apologise in advance if this is in a list FAQ.
>
> I have this rather simple xml file that contains the following:
>
> <shapeCollection>
> <shapeSet id="ID01">
> <square/>
> <rectangle/>
> <ellipse/>
> </shapeSet>
> <shapeSet id="ID02">
> <circle/>
> <square/>
> </shapeSet>
> <shapeSet id="ID03">
> <circle/>
> <ellipse/>
> </shapeSet>
> <shapeSet id="ID04">
> <circle/>
> <octagon/>
> </shapeSet>
> </shapeCollection>
>
>
> Where there is an arbirary number of shapeSets. How would I generate a
> collection of shape sets that didn't contain any shape set that had an
> ellipse in it? I would think this is a rather simple xslt script but I
admit
> that I'm so new at this that the idea of it is elluding me.
>
> Jeremy


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread