[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
We can perform such tests with XPath. Please consider this example:
XML file is:
XSLT stylesheet is:
<xsl:output method="text" />
</xsl:stylesheet>
On 9/14/06, Wolfgang Jeltsch <wolfgang@xxxxxxxxxxx> wrote:
http://gandhimukul.tripod.com
Re: [xsl] testing relationships between nodes
Subject: Re: [xsl] testing relationships between nodes From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Thu, 14 Sep 2006 21:59:26 +0530 |
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@xxxxxxxxxxx> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] testing relationships bet, Michael Kay | Thread | RE: [xsl] testing relationships bet, Michael Kay |
Re: [xsl] testing relationships bet, Wolfgang Jeltsch | Date | RE: [xsl] testing relationships bet, Michael Kay |
Month |
Keywords