I just started the reading of XSLT tutorial from Zvon.org and I am confused with very first example. Original Files:
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:
Why it didn�t pick the second �title� element. Even though we are using the Xpath expression �//title�?
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