我正在尝试将变量分配到xsl文件中,稍后在此文件中使用它们。
以下是我如何分配它们:
<xsl:choose>
<xsl:when test="matches(normalize-space(tokenize((//span[@class='timark' and matches(.,'Наименование и адрес')]/following-sibling::div[1]/p[@class='addr'])[1],',')[1]), 'BG[0-9]')">
<xsl:variable name="authtitle" select="normalize-space(tokenize((//span[@class='timark' and matches(.,'Наименование и адрес')]/following-sibling::div[1]/p[@class='addr'])[1],',')[2])" />
<xsl:variable name="authstreet" select="normalize-space(tokenize((//span[@class='timark' and matches(.,'Наименование и адрес')]/following-sibling::div[1]/p[@class='addr'])[1],',')[3])" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="authtitle" select="normalize-space(tokenize((//span[@class='timark' and matches(.,'Наименование и адрес')]/following-sibling::div[1]/p[@class='addr'])[1],',')[1])" />
<xsl:variable name="authstreet" select="normalize-space(tokenize((//span[@class='timark' and matches(.,'Наименование и адрес')]/following-sibling::div[1]/p[@class='addr'])[1],',')[2])" />
</xsl:otherwise>
</xsl:choose>
当我尝试使用它们时
<name>
<xsl:value-of select="$authtitle" />
</name>
我收到错误!为什么呢?
如果我只删除
<xsl:value-of select="$authtitle" />
行,没关系。所以我似乎没有正确访问变量。