• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using Attributes in XSLT

 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This shouldn't be too hard for someone.
Say I have some XML:
<somexml>
<sometag foo="stuff">differentstuff</sometag>
</somexml>
Now I want a template that will give me
<html>
. . .
<body>
<h1> somexml </h1>
<table>
<tr><td>stuff</td><td>differentstuff</td><tr>
</table>
If someone could give me a clue how to get the name of the element and the value of the attribute, I'd be much obliged.
regards
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andrew Shafer:
This shouldn't be too hard for someone.


Thank you!
That should work:
<html>
. . .
<body>
<h1> somexml </h1>
<table>
<tr><td><xsl:value-of select="somexml/sometag/@foo"/></td>
<td><xsl:value-of select="somexml/sometag"/></td><tr>
</table>
reply
    Bookmark Topic Watch Topic
  • New Topic