Re: [xsl] Remove node after testing for equality using value from external xml document

Subject: Re: [xsl] Remove node after testing for equality using value from external xml document
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Wed, 8 Feb 2006 07:30:55 -0600
On 2/8/06, Evans, Martin Chf Tech <Martin.Evans934@xxxxxx> wrote:
> Hi all,
> First time post and very much a newbie to xslt, however I have used the
> list before with some success.  Anyway to my problem.
> I have a fairly large xml document which I need to test a particular
> element for equality. If equal I would  like to remove the complete node
> and replace it with a comment. If not equal I just copy the node and
> move  on.

Perhaps it's the fact that I've only been up for about 15 minutes, but
I didn't see near enough information here.  On the other hand, no one
else has responded to your question.  It seems like you are asking for
a stylesheet that eliminates duplicates.  If you have used the list
before I'd imagine you would have checked that already.  My first
question is you are testing what to be equal to what.

> This I can achive on a singular node/element test, but I would like to
> now do it with a list/array of  values using variables embedded in the
> template or calling another xml doc and using it's fragment tree.


Ok, if it's not duplicates, maybe it's you are trying to find if the
value of an element is a member of a set of values (not equal to the

> Here are the sample files

lots of code, perhaps a simplified example could help?

>             <xsl:when test="self::Row[HARDWARE_PART_NO != 'EJ200-101']">
>                 <xsl:comment>Structural Part No Removed</xsl:comment>

Errrr, this seems to be testing for inequality with a constant value
as opposed to the value of two nodes being the same.

So if you're looking to remove duplicates, see the faq.

If you're trying to determine set membership, look at keys.  Use them
the same way you might use a hash in other programming languages.
There should be plenty in the faq.

Jon Gorman

Current Thread