You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Manish Balsara <ma...@aumsoft.com> on 2001/02/22 22:44:53 UTC
Xpath and child nodes
Is XPath expression applied to the root of the DOM node, even if I pass
the XPathAPI a child of the root node?
In my example,
<document>
<sku>
<description>Bicycle</description>
<price>100.00</price>
<currency>USD</currency>
</sku>
<sku>
<description>Banana Republic Khakhis</description>
<price>80.00</price>
<currency>USD</currency>
</sku>
<sku>
<description>GAP Khakhis</description>
<price>80.00</price>
<currency>DM</currency>
</sku>
</document>
I am passing the child nodes sku, expecting to apply the xpath expression
//sku/currency/text()
relative to that child node, instead of the root. Is there anyway I can
get this to work without having to use the XPath expression
//sku[n]/currency/text()
thanks
manish
Re: Xpath and child nodes
Posted by Manish Balsara <ma...@aumsoft.com>.
Sorry. I found the problem. The node I am passing is a contextNode rather
than the root node and hence I must use the expression
./currency/text
thanks
manish
On Thu, 22 Feb 2001, Manish Balsara wrote:
> Is XPath expression applied to the root of the DOM node, even if I pass
> the XPathAPI a child of the root node?
>
> In my example,
> <document>
> <sku>
> <description>Bicycle</description>
> <price>100.00</price>
> <currency>USD</currency>
> </sku>
> <sku>
> <description>Banana Republic Khakhis</description>
> <price>80.00</price>
> <currency>USD</currency>
> </sku>
> <sku>
> <description>GAP Khakhis</description>
> <price>80.00</price>
> <currency>DM</currency>
> </sku>
> </document>
>
>
> I am passing the child nodes sku, expecting to apply the xpath expression
> //sku/currency/text()
> relative to that child node, instead of the root. Is there anyway I can
> get this to work without having to use the XPath expression
> //sku[n]/currency/text()
>
> thanks
> manish
>
>