culd yu请告诉我如何在xslt中获取属性值?我创建变量,其中full name
(f)和short name
(s)。
使用全名我想得到短名称
这是我的代码 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>
预期输出: KXIP