XSLT后面的同级不返回值
我正试图为一个足球联盟创建一个排行榜。我对XSLT非常陌生,在这方面我很浮躁 下面是我拥有的数据格式 数据:XSLT后面的同级不返回值,xslt,xslt-1.0,Xslt,Xslt 1.0,我正试图为一个足球联盟创建一个排行榜。我对XSLT非常陌生,在这方面我很浮躁 下面是我拥有的数据格式 数据: 这是到目前为止我的代码 <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
这是到目前为止我的代码
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="html" indent="yes" encoding = "utf-8" standalone = "yes"/>
<xsl:variable name="allGames">
<map gametype="All Games" />
</xsl:variable>
<xsl:variable name="gameMapping" select="msxsl:node-set($allGames)/*" />
<xsl:template match="/">
<html>
<head>
<meta charset="utf-8" />
<title> Standings</title>
</head>
<body>
<h2> TEST </h2>
<table border="1" style="width: 100%;">
<tr>
<th>Club</th>
<th>GP</th> <!--Games Played-->
<th>W</th> <!--Wins-->
<th>L</th> <!--Loss-->
<th>T</th> <!--Ties-->
<th>%</th> <!--Win Loss Ratio-->
</tr>
<xsl:apply-templates select="//ifb-team/split[@name = 'All Games']" />
</table>
</body>
</html>
</xsl:template>
<xsl:template match="ifb-team/split">
<xsl:variable name="ti" select="../team-info" />
<tr>
<td>
<xsl:value-of select="$ti/@display-name" />
</td>
<td>
<xsl:value-of select="following-sibling::games-played/@games"/>
</td>
<td>
<xsl:value-of select="following-sibling::record/@wins"/>
</td>
<td>
<xsl:value-of select="following-sibling::record/@losses"/>
</td>
<td>
<xsl:value-of select="following-sibling::record/@ties"/>
</td>
<td>
<xsl:value-of select="following-sibling::record/@percentage"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
排名
试验
俱乐部
全科医生
W
L
T
%
我得到的只是一张有显示名称的桌子,其他什么都没有。我没有得到任何兄弟姐妹的数据。我错过了什么 这很简单:
<td>
<xsl:value-of select="games-played/@games"/>
</td>
<td>
<xsl:value-of select="record/@wins"/>
</td>
<td>
<xsl:value-of select="record/@losses"/>
</td>
<td>
<xsl:value-of select="record/@ties"/>
</td>
<td>
<xsl:value-of select="record/@percentage"/>
</td>
玩的游戏
不是兄弟姐妹--它是分裂的孩子
记录
也是如此
因此,请使用:
<td>
<xsl:value-of select="games-played/@games"/>
</td>
<td>
<xsl:value-of select="record/@wins"/>
</td>
<td>
<xsl:value-of select="record/@losses"/>
</td>
<td>
<xsl:value-of select="record/@ties"/>
</td>
<td>
<xsl:value-of select="record/@percentage"/>
</td>
这很简单:
<td>
<xsl:value-of select="games-played/@games"/>
</td>
<td>
<xsl:value-of select="record/@wins"/>
</td>
<td>
<xsl:value-of select="record/@losses"/>
</td>
<td>
<xsl:value-of select="record/@ties"/>
</td>
<td>
<xsl:value-of select="record/@percentage"/>
</td>
玩的游戏
不是兄弟姐妹--它是分裂的孩子
记录
也是如此
因此,请使用:
<td>
<xsl:value-of select="games-played/@games"/>
</td>
<td>
<xsl:value-of select="record/@wins"/>
</td>
<td>
<xsl:value-of select="record/@losses"/>
</td>
<td>
<xsl:value-of select="record/@ties"/>
</td>
<td>
<xsl:value-of select="record/@percentage"/>
</td>
@KurtAbele,绝对——XPath是XSLT和XQuery的核心。@KurtAbele,绝对——XPath是XSLT和XQuery的核心。