• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSL: cycle every element

 
Marco Rossi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to verify if any element of an XML file contains an attribute called "id"; for example:



And this is what I wrote but it seems not working



When I print $currentNode I would like to get printed the name of the node.

Thanks
Marco
 
Paul Clapham
Sheriff
Posts: 21116
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what that "$xmlfile" variable might be, but you are only looking at its children in that code, not all of its descendants.

Why don't you just write an XPath expression which selects all nodes with an "id" attribute? That would be far easier than writing your own code to search the document.
 
g tsuji
Ranch Hand
Posts: 666
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Marco Rossi
Instead of this:
>select="$currentNode"
do this
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic