XML/XSL newb q: can I ever select or refer to xml attribute values?

5tein

Usenet Archive
Joined
Apr 29, 2004
Messages
1
Reaction score
0
I mean, with XSL functions such as SELECT can I only refer to XML element values or can I somehow also refer to XML attribute values? Is there any way to refer to XML content based on attribute values? Or is it a parsed data only thing?

BTW, new to XML; sorry if this is a dumb question. I just haven't seen this explicitly stated anywhere (though by experience it doesn't seem to work).
 

Patrick TJ McPhee

Usenet Archive
Joined
Apr 2, 2000
Messages
269
Reaction score
0
% I mean, with XSL functions such as SELECT can I only refer to XML % element values or can I somehow also refer to XML attribute values?

I hate it when people as questions in the subject line, then don't repeat them in the body of the message.

Select isn't a function -- rather it's an attribute of several elements. This attribute always contains an xpath expression, so you can refer to anything xpath can refer to.

As it happens, you can refer to attributes. It's worth reading an introduction to xpath, but you can do something like

<xsl:value-of select='@x'/>

to get at the value of attribute x of the current node.
 

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
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top