XSLT error when getting variable

141 views Asked by At

I am trying to assign variables into xsl file and use them later in this file.

Here is how i assign them:

<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>

And when i try to use them

<name>
                        <xsl:value-of select="$authtitle" />
                    </name>

I get Error! Why?

If i remove only the

<xsl:value-of select="$authtitle" />

line , it is OK. So it seems i am not accessing the variable correctly.

0

There are 0 answers