xsl-list
[Top] [All Lists]

RE: Exclude elements in transformation

2004-09-16 02:40:59


I want to exclude each element that is preceeded by a 
specific tag, call it A.

So i have XML like:

<A>blah</A>
<B>blub</B>

I have a XSLT template for A and that includes the following 
element (B here). So now i need a template for each element 
that is preceeded by A and does nothing, but i don't know the 
Xpath expression or it.

This will do what you ask:

<xsl:template match="*[preceding-sibling::A]"/>

But I suspect there might be a better solution - I think it's preferable
to not select the nodes to process in the first place, rather than
select everything and use a no-op template to suppress the things you
don't want.  You would need to give a little more information for that
kind of answer.

cheers
andrew


<Prev in Thread] Current Thread [Next in Thread>