Getting Value from XML and Store In Variable Using XSLT -
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <result> <resultdetails> <resultdetailsdata> <itemproperties> <id>1</id> <type>level</type> <value xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xs="http://www.w3.org/2001/xmlschema" xsi:type="xs:int">5</value> </itemproperties> </resultdetailsdata> </resultdetails> </result>
i have xml described above. want value of value tag (in case, '5') using value of type tag, (i.e., level in case) , store in variable using xslt, can use variable later.
any idea how do ?
you way:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:template match="/"> <xsl:variable name="myvar" select="result/resultdetails/resultdetailsdata/itemproperties/value"/> <varoutput> <xsl:value-of select="$myvar"/> </varoutput> </xsl:template>
applied input xml output:
<?xml version="1.0" encoding="utf-8"?> <varoutput>5</varoutput>
regards, peter
Comments
Post a Comment