I’m transforming an XML document to HTML, and wish to pick out a few particular elements (for use in the head.title of the HTML page).
My source XML looks thusly:
<document>
<vars>
<var name="serialno">
12345 <<--- I want THIS value
</var>
<var name="rev-date" rev="old">
2000-01-01
</var>
<var name="rev-date" rev="new">
2011-05-01 <<--- ...and also THIS value
</var>
... more vars
</vars>
... more data
</document>
Now, the serial would be something along the lines of “<xsl:value-of select="/vars/var@serialno"/>“, but I can’t figure out how to address the var with that particular name. Similarly for the revision date, except that I need to specify two attributes. How do I do that?
Use:
to obtain the desired text node or just
to get the desired string.
And use:
to obtain the 2nd desired text node or just
to get its string value.