xsl-list
[Top] [All Lists]

Re: [xsl] how to find parent node

2007-01-23 08:29:03

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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