xsl-list
[Top] [All Lists]

Re: [xsl] xpath query

2008-01-18 15:21:08
Senthil Nathan wrote:
Hi,
Thanks. And as per xml standards i can't have a tag as <1>.
So, if I have that as attribute,

You cannot. You cannot have, i.e.: <node 1="value" />. You can, however, have <node attr="&lt;1>" />, which is as close as it can get to have "<1>" as attribute (value).

can i use xpath to specifically
select that node.

only if you have a node that is valid XML in the input, of course ;) then yes (you can select about anything in XML with XPath).

ie., with the foll. xml,
<root>
<level1>
    <a id="1">......</a>
    <a id="2">......</a>
</level1>
</root>

Is the following correct, /root/level1/*[(_at_)id='1']/* to select all
children of <a id="1">

No. It will select all children of all nodes directly under 'level1' with an id="1" (i.e., if you have <b id="i1"> its children will also be selected). If you want all children of <a id="1">, write:

/root/level1/a[(_at_)id="1"]/*

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>