[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] how to find parent node


Subject: Re: [xsl] how to find parent node
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 23 Jan 2007 15:28:49 GMT

> If using name() is not a good idea, are there other ways to find the
> parent?

name() isn't usuallay a good idea as the value used depends on the
prefix used in the source (or potentially, in xslt1, a prefix generated
by the xml parser). Why do you need to do a test at all, it's rather
rare, really.

If you want to do something different for a test1 element if it is
contained in a para, just have two templates,

one for most test1 elements

<xsl:template match="test1">
 something
</xsl:template>

and a higher priority one for test1 in para



<xsl:template match="para/test1">
 something different if parent is para
</xsl:template>


so no need for any xsl:if test.

David


Current Thread
Keywords
xml