Re: Simple Conditionals

Subject: Re: Simple Conditionals
From: "Richard Lander" <rlander@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Apr 1999 21:15:07 -0400
 Doug,

I suggest trying an xsl:choose .

Check out the following code that I use to generate a list of sections of a
document, generating a link if an ID exists for a section and just the text
if no ID exists. This code is part of my root rule.

 <UL class="LIST">

 <xsl:for-each select="REPORT/SECTION">

 <LI>

 <xsl:choose>
 <xsl:when test="./@id">
 <A href="#{@id}">
 <xsl:value-of select="./TITLE"/>
 </A>
 </xsl:when>

 <xsl:otherwise>
 <xsl:value-of select="./TITLE"/>
 </xsl:otherwise>
 </xsl:choose>

 </LI>

 </xsl:for-each>

 </UL>

Richard.

----- Original Message -----
From: Douglas Nehring <dnehring@xxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Thursday, April 15, 1999 7:12 PM
Subject: Simple Conditionals


> As my baby steps in XSL continue, more questions....
>
> Can XSL do processing conditional?  What I'm looking to do is color the
rows
> of my table based on an element's attribute.
>
> For example:
> <entry type="type1">
>  <body>text</body>
> </entry>
>
> <entry type="type2">
> <body>more text</body>
> </entry>
>
> The xsl would then create a table, and place the body text for each entry
in
> its own row.  Entries of type1 should have a text color of red, and
entries
> of type 2 should be blue.
>
> I can create the tables/rows/divs/spans, I "just" need a few pointers on
how
> to do conditional processing if possible.
>
> Thanks,
>
> Doug Nehring
> Nortel Networks
> MSL-100 Advanced Technology
> Richardson, TX
> (972) 685-2096, ESN 445-2096
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread