0

我正在尝试将变量分配到 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" />

线,没关系。所以看来我没有正确访问变量。

4

0 回答 0