[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Simple Conditionals
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|