wood burning stoves
The moose likes XML and Related Technologies and the fly likes checking for attribute nodes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "checking for attribute nodes" Watch "checking for attribute nodes" New topic

checking for attribute nodes

Max White
Ranch Hand

Joined: Jun 28, 2008
Posts: 85
I am trying to convert the attribute text to upper case.
Sample xml -

xsl -

The output xml contains everything from the source xml but the attribute.
What's wrong in the template, matching attribute?

g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 632
If you want to structuring xsl like this separating out attribute template, you need to add @* to the apply-templates select because an attribute must be a child of an element. But some detail may be tricker in concept. In the @* template, it is simply non-sense to script apply-templates. An attribute as leaf would have no subnode. A xsl:copy would do it all.

[1] Do you know what a select or match of node() means? It means *|text() quite literally. So use more consistent form would show you off as having a clearer understanding.
[2] You might one day see @* being integrated into the *|text() in the match attribute. That is the usual concise way to write a so-called identity transformation...
[3] I take out apply-templates within the @* template for the semantic reason, you can put it there and it won't be erroring out of any kind in xslt as it is a kind of functional language. Only that it is "non-sense" in my sense and I mean just that.
Max White
Ranch Hand

Joined: Jun 28, 2008
Posts: 85
Thanks Tsuji.I got my mistake
I agree. Here's the link: http://aspose.com/file-tools
subject: checking for attribute nodes
It's not a secret anymore!