• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Need Help with XSLT  RSS feed

 
Ranch Hand
Posts: 58
  • 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 ]
 
Greenhorn
Posts: 7
  • 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
  • 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
 
Ranch Hand
Posts: 5040
  • 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
  • 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!