View Full Version : XSL - How to test presence of some node names in all ancestors?
senglory
10-22-2009, 03:09 AM
I need to do some actions for, say <w:p>, but only if there's no <w:tab> in his ancestors across the whole list of them. How can I do this in xsl:if ?
oesxyl
10-22-2009, 03:43 PM
I need to do some actions for, say <w:p>, but only if there's no <w:tab> in his ancestors across the whole list of them. How can I do this in xsl:if ?
why in if?
best regards
senglory
10-22-2009, 07:26 PM
because I don't want to put extra template but rather change the existing one. It's rather lengthy right now.
rnd me
10-22-2009, 08:05 PM
test="count(.//w:tab)=0"?
senglory
10-22-2009, 08:28 PM
Not in descendants but in ancestors.
oesxyl
10-22-2009, 09:26 PM
Not in descendants but in ancestors.
without testing I'm not so sure if will work
*[name() != 'w:tab']/*/w:p
I would prefere to use two templates instead of a test, I'm sure is faster.
best regards
rnd me
10-23-2009, 01:43 AM
Not in descendants but in ancestors.
doh!
if you were "on" w: p,
test="not(ancestor[w:tab])"?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.