Assigning value to variable based on xsl:choose test

Joined
Aug 3, 2010
Messages
1
Reaction score
0
Hello,

can somebody tell me why this code does not work?

Code:
<xsl:variable name="pagesvar">
    <xsl:choose>
        <xsl:when test="/p/divi/text() = 'bla'">
            <xsl:value-of select="/p/navigation/page//page[template='T1']"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="/p/navigation/page//page[template='T2']"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

I know that following code works, but in the future I will have more test cases, so its just a temporary solution.
Code:
<xsl:variable name="pagesvar" select="if (/p/divi/text()='bla') then /p/navigation/page//page[template='T1'] else /p/navigation/page//page[template='T2']"/>
thanks,
michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top