Subject: Re: [xsl] xpath query From: "Senthil Nathan" <rsennat@xxxxxxxxx> Date: Sat, 19 Jan 2008 03:32:48 +0530 |
Hi, Thanks. And as per xml standards i can't have a tag as <1>. So, if I have that as attribute, can i use xpath to specifically select that node. ie., with the foll. xml, <root> <level1> <a id="1">......</a> <a id="2">......</a> </level1> </root> Is the following correct, /root/level1/*[@id='1']/* to select all children of <a id="1"> Thanks Senthil Nathan R On 1/19/08, Michael Kay <mike@xxxxxxxxxxxx> wrote: > You expression > > /ROOT/LEVEL2/*[@apply='1'] > > is almost right, but the elements with the @apply attribute are not children > of LEVEL2, they are grandchildren. So you want > > /ROOT/LEVEL2/*/*[@apply='1'] > > or if you want elements at any level, > > /ROOT/LEVEL2//*[@apply='1'] > > Michael Kay > http://www.saxonica.com/ > > > -----Original Message----- > > From: Senthil Nathan [mailto:rsennat@xxxxxxxxx] > > Sent: 18 January 2008 20:50 > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: [xsl] xpath query > > > > hi all, > > what could be the xpath query with the foll. xml, to select > > all the nodes with apply="1" in the LEVEL2 from ROOT. > > > > <ROOT> > > <LEVEL1> > > <A> > > <a apply="1">100</a> > > <b apply="1">100</b> > > <c>100</c> > > </A> > > </LEVEL1> > > > > <LEVEL2> > > <B> > > <a>100</a> > > <b apply="1">100</b> > > <c>100</c> > > </B> > > <C> > > <a>100</a> > > <b>100</b> > > <c apply="1">100</c> > > </C> > > <LEVEL2> > > </ROOT> > > > > I tried using /ROOT/LEVEL2/*[@apply='1']. But it doesn't > > select the intended nodes. > > > > Thanks > > Senthil Nathan R
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xpath query, Michael Kay | Thread | Re: [xsl] xpath query, Abel Braaksma |
Re: [xsl] xpath query, Abel Braaksma | Date | Re: [xsl] xpath query, Abel Braaksma |
Month |