XSLT: объявление переменной

Объявление переменной в зависимости от условия

<xsl:variable name="user_id">
    <xsl:choose>
        <xsl:when test="/page/user">
      <xsl:value-of select="/page/user/@id"/>
    </xsl:when>
        <xsl:when test="/ajx/search/user">
      <xsl:value-of select="/ajx/search/user/@id"/>
    </xsl:when>
        <xsl:otherwise>0</xsl:otherwise>
    </xsl:choose>
</xsl:variable>

LEAVE A COMMENT