Hi,
My xml sample data as below
<a>
<b>
<c test1 ="1">
<d> ass</d>
<e name="n1" number="12">
<row id="0">
<field name="valuetobetaken" type="string">
gfghg
</field>
<field name="test1" type="string1">
gfghg
</field>
</row>
<row id="1">
<field name="test2" type="string">
gfghg
</field>
<field name="test3" type="string1">
gfghg
</field>
</row>
</e>
</c>
</b>
</a>
I need to take the attribute value of name("valuetobetaken") from
the element field using xslt
<c test1 ="1">
<d> ass</d>
<e name="n1" number="12">
<row id="0">
<field name="valuetobetaken"
my xslt file as below
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:variable name="test" select="." />
<xsl:for-each select ="$test/a/b">
<xsl:value-of select="c[@test1=1]/d[@name='n1'][@number=12]/row
[@id=12]/field[@name]">
</xsl:value-of>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
the output is always coming as blank as below
<?xml version="1.0" encoding="utf-8"?>
attribute value is missing in the output.
is there any problem in the select statement of xsl?
I would like to know, how to take the attribute value, element value
of field for the above scenario
Thanks,
Sony