This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Problem with xsl:choose


try 
<xsl:when test=" main/@timer = 'On'">
and similar :)
Yogesh
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Lakshmi
Narayanan K
Sent: Wednesday, August 08, 2001 1:25 PM
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] Problem with xsl:choose


Hi there,

I am having a problem with xsl:choose.

I have an xml file in the following format

<main>
.
.
.
    <timer> On </timer> (this could be either "On" of "Off" or "Manual")
.
.
.
</main>

Now, I wrote an xsl file that would check the value of timer, and print out
an appropriate text.

My xml file was
.
.
.
<!-- main/timer -->
    <xsl:template match = "main/timer">
        <xsl:choose>
            <xsl:when test=" main/timer = 'On'">
                <xsl:text>Timer is On</xsl:text>
            </xsl:when>
            <xsl:when test="main/timer = 'Off'">
                <xsl:text>Timer is Off</xsl:text>
            </xsl:when>
            <xsl:otherwise>
                <xsl:text>Timer is Manual</xsl:text>
            </xsl:otherwise>
       </xsl:choose>
    </xsl:template>

Now the problem is, when the parser checks the XML file, it must logically
go into the xsl:when defined for the On status.But it always skips all the
xsl:when's and moves into the xsl:otherwise block, and hence whatever is
defined in the otherwise only gets outputted. No errors are outputted.

Please help. I am stuck with this for the past 4 hours. Thanks and regards,

Lakshmi Narayanan


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]