• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Need Help with XSLT

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
must because of the typo - > <titel>XML</title>
"titel" instead of "title"
 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic