remove from xsl nodeset

117 views Asked by At

Say you have a document like this:

<A>
    <B>
        <C>one</C>
    </B>
    <B>
        <C>two</C>
    </B>         
    <B>
        <C>three</C>
    </B>
</A>

You then use xsl to create a nodeset of B nodes

<xsl:variable name="bSet" select="//A/B"/>

You now have this:

    <B>
        <C>one</C>
    </B>
    <B>
        <C>two</C>
    </B>         
    <B>
        <C>three</C>
    </B>

What is the accepted method for deleting a a particular set of nodes from this nodeset in xsl 1.0? For example you only want B's with a C that is either 'one' or 'two', but not 'three' like this?

    <B>
        <C>one</C>
    </B>
    <B>
        <C>two</C>
    </B>

How might you do this in xsl, with a more exclusve selector r can you delete from the nodeset after you have declared it(ie, is it dynamic lie a java Arraylist)?

1

There are 1 answers

3
michael.hor257k On BEST ANSWER

The expression:

$bSet[not(C='three')]

selects:

<B>
    <C>one</C>
</B>
<B>
    <C>two</C>
</B>

I am afraid I didn't understand your "extension" question.