*
The moose likes XML and Related Technologies and the fly likes [XSL][XPath] Retrieve attribute by its name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "[XSL][XPath] Retrieve attribute by its name" Watch "[XSL][XPath] Retrieve attribute by its name" New topic
Author

[XSL][XPath] Retrieve attribute by its name

Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1049
Hi,
i have the strange but unavoidable task to build table-rows from columns.
Because no sort order can be garanteed, i'd like to retrieve attributes by their names.
I tried x variations but none worked. Can someone help me with it?

I have a loop for each row at the moment but i'd prefer to do it in a named template.
Thanks in advance
cb
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4344
    
    8

I haven't tried it out, but all I think you need to do is change name to name() in line 18.

name
gives you the value of sub-elements called 'name' (which don't exist). name() gives you the name of the current node, which is what you want.
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1049
Works. Cool, thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: [XSL][XPath] Retrieve attribute by its name
 
Similar Threads
How to Add a Line Counter for Each XML Element in XSL?
Creating a chart using xslt
Walk distinct values in xsl key 4 at a time
XSLT : Grouping Child Nodes...
xsl to merge duplicate tag