xsl-list
[Top] [All Lists]

Re: [xsl] xpath query

2008-01-18 14:05:54
Senthil Nathan wrote:
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/*[(_at_)apply='1']. But it doesn't select the
intended nodes.

It helps if you indent your code correctly, than it easily shows that you missed one axis step:

/ROOT/LEVEL2/*/*[(_at_)apply='1']

With indentation I mean this:

<ROOT>
   <LEVEL2>
       <A>
             <a>...</
             <b apply='1'>...</
        </
    </
</

this makes it visually clear that there's still a step between <LEVEL2> and <a>, <b> etc, namely <A>, <B> etc.

HTH,
Cheers,
-- Abel Braaksma

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

<Prev in Thread] Current Thread [Next in Thread>