Re: [xsl] to get the descendants at only one level - xpath

Subject: Re: [xsl] to get the descendants at only one level - xpath
From: "Senthil Nathan" <rsennat@xxxxxxxxx>
Date: Wed, 6 Feb 2008 23:57:47 +0530
Actually I'm giving the xpath query to the libxml2 library and it
returns everything under that path for that query.
/root/level1/child::*

I tried the other solution also, /root/level1/* which also does the same.

Senthil

On 2/6/08, David Carlisle <davidc@xxxxxxxxx> wrote:
>
>
> > I need to select only child1, 2, 3 and not any of the childs of these.
>
> no it just selects child1 child2 child3, depending what you do with
> child3 having selected it you may see the descendents.
>
> so for example select="/root" just selects a single element, if you call
> name() on it you just get a single string "root" but if you say
> <xsl:copy-of select="/root"/>
> you get the whole document tree back as child nodes are properties of an
> element so the copied node has copies of the same children.
>
> perhaps ypu want
> <xsl:for-each select="/*/*/*"
>  <xsl:copy/>
> </xsl:for-each>
>
> note that the selection is as previously suggested, but I'm guessing how
> you want to use the selected nodes (using <xsl:copy/>) you haven't shown
> how you have used them or what you want to generate, so I can only guess.
>
> David
>
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________

Current Thread