Re: [xsl] xpath question

Subject: Re: [xsl] xpath question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 24 Jan 2007 14:58:54 GMT
I can't remember if you are using xslt2 or xslt1, a direct encoding of

> if I want to locate only the <scene>
> element under ALL<list1> elements in the whole XML input inside the
> <list1> template, and NOT the <scene> element under <list2>, 

in xpath2 would be

.//scene except .//list2//scene

in xpath1 you could use

.//scene[not(ancestor::list2)]

(which doesn't mean quite the same thing in general but will select the
same things so long as list1 is never a descendent of list2.

However are you sure you need to process all scene elements out of
sequence like this?

more commonly in xslt you woul djust have a tempolate for scene elements

<xsl:tempate match="scene">...

and a higher priority template for scenes under list2


<xsl:tempate match="list2//scene">...

and so don't need to explictly select those scenes which are under list1
but not under list2, they automatically are matced by the first
template.

David

Please read the posting guidelines for this list which advise you not to
use subject lines such as  "xpath question" which could apply to most of
teh postings on this list.

Current Thread