Get root attribute values

G

GIMME

Hi,

<root some_attr="edit">
<a/><a/>
<root>

How do I access the value of some_attr when processing <a/> ?

Sort of like if I had
<root>
<some_attr>edit</some_attr>
</root>

Then I could count on fetching some_attr as /root/some_attr .
But here I want to use an attribute not an element as in the
sort of like example.

Thanks.
 
A

Alex Shirshov

Hello, GIMME!
You wrote on 8 Apr 2004 17:56:55 -0700:

G> <root some_attr="edit">
G> <a/><a/>
G> <root>

G> How do I access the value of some_attr when processing <a/> ?

If the context node is a, then you can get the value of some_attr by the
following xpath

.../@some_attr


[Sorry, skipped]


With best regards, Alex Shirshov.
 
G

GIMME

Thanks Alex,

Is there a top down solution rather than a bottom up solution,
or is that it?
 
P

Patrick TJ McPhee

[reorganised and cut down ...]


%
[...]

% > If the context node is a, then you can get the value of some_attr by the
% > following xpath
% >
% > ../@some_attr

% Is there a top down solution rather than a bottom up solution,
% or is that it?

You can use /root/@some_attr.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top