S
sp
i have an xml file
<catalog>
<cd>
<title>Romanza</title>
<artist>Andrea Bocelli</artist>
<country>EU</country>
<company>Polydor</company>
<price>10.80</price>
<year>1996</year>
</cd>
<cd>
<title>When a man loves a woman</title>
<artist>Percy Sledge</artist>
<country>USA</country>
<company>Atlantic</company>
<price>8.70</price>
<year>1987</year>
</cd>
<cd>
<title>Black angel</title>
<artist>Savage Rose</artist>
<country>EU</country>
<company>Mega</company>
<price>10.90</price>
<year>1995</year>
</cd>
<cd>
<title>1999 Grammy Nominees</title>
<artist>Many</artist>
<country>USA</country>
<company>Grammy</company>
<price>10.20</price>
<year>1999</year>
</cd>
</catalog>
i need to get the individual elements value under the cd tag
and my xsl looks like
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl
aram name="mycount" />
<xsl
aram name="myelement" />
<xsl:template match="/">
<xsl:for-each select="/catalog/cd">
<xsl:if test="position()=$mycount>
<xsl:value-of select="$myelement" />
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
and when i pass the name of the elements like "title" or "artist" or
"country" etc.,,,
my output is
the string value of the tag i passed (i.e, if i pass "title" output is
"title")
how is that i can get the value of the title like Romanza which is at
position 1
can anybody help me
-praveen
<catalog>
<cd>
<title>Romanza</title>
<artist>Andrea Bocelli</artist>
<country>EU</country>
<company>Polydor</company>
<price>10.80</price>
<year>1996</year>
</cd>
<cd>
<title>When a man loves a woman</title>
<artist>Percy Sledge</artist>
<country>USA</country>
<company>Atlantic</company>
<price>8.70</price>
<year>1987</year>
</cd>
<cd>
<title>Black angel</title>
<artist>Savage Rose</artist>
<country>EU</country>
<company>Mega</company>
<price>10.90</price>
<year>1995</year>
</cd>
<cd>
<title>1999 Grammy Nominees</title>
<artist>Many</artist>
<country>USA</country>
<company>Grammy</company>
<price>10.20</price>
<year>1999</year>
</cd>
</catalog>
i need to get the individual elements value under the cd tag
and my xsl looks like
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl
<xsl
<xsl:template match="/">
<xsl:for-each select="/catalog/cd">
<xsl:if test="position()=$mycount>
<xsl:value-of select="$myelement" />
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
and when i pass the name of the elements like "title" or "artist" or
"country" etc.,,,
my output is
the string value of the tag i passed (i.e, if i pass "title" output is
"title")
how is that i can get the value of the title like Romanza which is at
position 1
can anybody help me
-praveen