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

Re: Simple Conditionals

Subject: Re: Simple Conditionals
From: "James Tauber" <jtauber@xxxxxxxxxxx>
Date: Fri, 16 Apr 1999 08:29:20 +0800
conditionals type1
> Can XSL do processing conditional?

It certainly can. Quite powerfully, actually.

  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.

<template match='entry[@type="type1"]/body'>
  <html:td><html:font color="red"><apply-templates/></html:font></html:td>
</template>

<template match='entry[@type="type2"]/body'>
  <html:td><html:font color="blue"><apply-templates/></html:font></html:td>
</template>

For most powerful conditions, have a look at choose, when and otherwise.
There is an example at
http://www.xmlsoftware.com/articles/xsl-by-example.html

Hope this helps.


James
--
James Tauber / jtauber@xxxxxxxxxxx / www.jtauber.com
XML Standards and Product Coordinator
HarvestRoad Communications / www.harvestroad.com.au

Full-day XML Tutorial @ WWW8 : http://www8.org/

Maintainer of : www.xmlinfo.com,  www.xmlsoftware.com and www.schema.net



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


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.