We can perform such tests with XPath. Please consider this example:
XML file is:
<?xml version="1.0" encoding="UTF-8"?>
<x>
<y>
<z/>
</y>
</x>
XSLT stylesheet is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates select="x" />
</xsl:template>
<xsl:template match="x">
<xsl:if test=".//z">
x is ancestor of z
</xsl:if>
</xsl:template>
</xsl:stylesheet>
If this is a general XPath question, then I think above could be the
appropriate answer.
If you need to do something specific, please let us know. There could
be other explanations.
On 9/14/06, Wolfgang Jeltsch <wolfgang(_at_)jeltsch(_dot_)net> wrote:
Hello,
alas, I cannot see any way to check whether a given node is an ancestor of a
given other node in XPath. How do I do this?
Best wishes,
Wolfgang
--
Regards,
Mukul Gandhi
http://gandhimukul.tripod.com
--~------------------------------------------------------------------
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>
--~--