【发布时间】:2015-11-25 05:16:57
【问题描述】:
我有以下示例配置。我有一个 xsl,其中我将空格分隔的范围(getAccoutInfo getCustomerInfo)存储在变量“范围”中,您在下面的范围元素中看到的内容作为单独的输入属性。我正在使用 str:tokenize 标记它们
<scopes>
<scope input="getAccountInfo" output="Account_Information"/>
<scope input="getCustomerInfo" output="Customer_Information"/>
</scopes>
<xsl:variable name="scopes" select="str:tokenize($scope, ' ')"/>
<ul style="list-style-type:disc">
<li>
<font size="2" style="font-family:verdana">
<xsl:apply-templates select="$scopes[position()]"/>
</font>
</li>
</ul>
我正在尝试使用“应用模板”将“输入”属性的相应“输出”属性的值打印为项目符号点,如上述配置中所示。模板复制如下。
<xsl:template match="token">
<xsl:if test="$scopeMapping/*[local-name()='scopes']/*[local-name()='scope']/@*[local-name()='input']/text() = normalize-space(.)">
<xsl:value-of select="$scopeMapping/*[local-name()='scopes']/*[local-name()='scope']/@*[local-name()='output']/text()"/>
</xsl:if>
</xsl:template>
但看起来 xsl 代码对我不起作用。有人可以指出错误并指出正确的方向吗?
【问题讨论】:
-
你能在这种情况下显示你期望的输出吗?谢谢!
-
请发布一个可重现的示例 - 请参阅:stackoverflow.com/help/mcve
-
@TimC 输出应如下所示,带有要点: • Account_Information • Customer_Information–
标签: xml xslt xpath xml-parsing