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

5

5tein

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).
 
P

Patrick TJ McPhee

% 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
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top