I have an xml file which contains following:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<q>sdfsdf</q>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
</catalog>
And I have two XSL files XSL#1:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="catalog/cd/title"/>
</xsl:template>
</xsl:stylesheet>
And XSL#2:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="//cd">
<xsl:value-of select="title"/>
</xsl:template>
</xsl:stylesheet>
When I use XSL#1 result is: “Empire Burlesque” but when I use XSL#2 result is: “sdfsdf Empire Burlesque”. Why does XSL#2 return such value? Is it possible to get value of child node “title” when parent node “cd” is matched?