xsl-list
[Top] [All Lists]

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

2008-02-06 11:28:16
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(_at_)nag(_dot_)co(_dot_)uk> 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.
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--