[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problem with xsl:choose

Subject: Re: Problem with xsl:choose
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Wed, 8 Aug 2001 10:06:40 +0200
xsl timer
On Wed, Aug 08 '01 at 13:24, Lakshmi Narayanan K wrote:
> I have an xml file in the following format
> 
> <main>
>     <timer> On </timer>
> </main>
> 
> My xsl 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>
Your match changes the context to main/timer. In the when, you ask for a
main/timer there. For your xsl-t to work your xml must look like:
<main>
  <timer>
    <main>
      <timer> On </timer>
    </main>
  </timer>
</main>

what you want is either:

<xsl:template match="/">
...
</xsl:template>

or

<xsl:when test=".='On'">

-- 
Goetz Bock                                              IT Consultant
Dipl.-Inf. Univ.

Attachment: pgp00002.pgp
Description: PGP signature

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.