Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

checking for attribute nodes

 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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?

Thanks
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

ps:
[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
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tsuji.I got my mistake
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic