This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Help with XSLT

 
Vivek Saxena
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started the reading of XSLT tutorial from Zvon.org and I am confused with very first example.
Original Files:


XML File:



XSL File:



Output File:


Up to This point everything is clear. We are using Xpath expression ="//title"/ and this is why we are getting the output file.
But when I tried to change the XML File with same style sheet it didn�t give me the expected output. The output file is still the same old file.

Changed XML File:



Output File:



Why it didn�t pick the second �title� element. Even though we are using the Xpath expression �//title�?

Please explain it?
Thanks
[ March 05, 2003: Message edited by: Vivek Saxena ]
 
Madhan Ramalingam
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
must because of the typo - > <titel>XML</title>
"titel" instead of "title"
 
Vivek Saxena
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No Not because of this, because my XML file is correct.

I did this typo when i was writing this post.
Please help me!, looking forward for some help.
thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vivek:
The value-of function of XSLT produces a node not a node set. If more than one values are possible, then it produces the "nearest one".
If I understood that right, I am thinking it would output the "title" element nearest to the axes, in this case it is "/decendant-or-self::" (for //, right?).
So the output is (nearest to the root node "/") will be seen. Hence, the result.
Anyone else has a different view, feel free....
regds.
- madhav
 
Vivek Saxena
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Madhav,
I think you are absolutely right. This was a big confusion for me but I guess it is over now.
Thanks again!
Vivek
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic