Groups > Design > Microsoft xsl > Re: conditional matching




conditional matching

conditional matching
Mon, 14 Apr 2008 10:52:20 -070
1) I need to match an element A provided it is one of the first three
children of element Z. Alternatively, I could just match A and then
conditionally process it within the template rule.

2) I need to match element B provided all its preceding siblings are
any or all of elements W, X, or Y. Again, I could use xsl:if
statements to apply the conditional logic.

I can't seem to wrap my head around how to do these things. It should
Post Reply
Re: conditional matching
Mon, 14 Apr 2008 20:08:30 +020
* larrysulky@gmail.com wrote in microsoft.public.xsl:
>1) I need to match an element A provided it is one of the first three
>children of element Z. Alternatively, I could just match A and then
>conditionally process it within the template rule.

That's A[parent::Z and count(preceding-sibling::*) <= 3].

>2) I need to match element B provided all its preceding siblings are
>any or all of elements W, X, or Y. Again, I could use xsl:if
>statements to apply the conditional logic.

B[not(preceding-sibling::*[ ... check names here ... ])].
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
Post Reply
about | contact