xml - how to get attribute value in xslt? -
culd yu please tell me how attribute value in xslt?. make variable in have full name
(f) , short name
(s). using full name want short name
here code http://xsltransform.net/ehvyzmp/1
<?xml version="1.0" encoding="utf-8" ?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <xsl:output method="html" doctype-public="xslt-compat" omit-xml-declaration="yes" encoding="utf-8" indent="yes" /> <xsl:variable name="teams"> <team f="sunrisers hyderabad" s="srh"></team> <team f="delhi daredevils" s="dd"></team> <team f="gujarat lions" s="gl"></team> <team f="kings xi punjab" s="kxip"></team> <team f="kolkata knight riders" s="kkr"></team> <team f="mumbai indians" s="mi"></team> <team f="rising pune supergiant" s="rps"></team> <team f="royal challengers bangalore" s="rcb"></team> </xsl:variable> <xsl:variable name="up" select="'kings xi punjab'"/> <xsl:template match="/"> <hmtl> <head> <title>new version!</title> </head> <xsl:value-of select="exsl:node-set($teams)/team[@f = $up]/@s"/> </hmtl> </xsl:template> </xsl:transform>
expected output: kxip
see edited code @ http://xsltransform.net/ehvyzmp/8 answer.
Comments
Post a Comment