Format Data Conditionally

The last action we will perform on the table is to write an XPath expression to display the `R' rating for movies in a bold red.

24. Click the rating glyph.
25. In the Properties window, expand the Default Color property.
26. Click the XPath field, and then click the "more" button ( ).

Stylus Studio displays the XPath Editor dialog box.

27. Type the following XPath expression:

      if (rating = 'R') then 'red' else ""
       

    

Notice Stylus Studio's Sense:X auto-completion and text coloring as you type.

Figure 496. XPath Editor Dialog Box

28. Click OK.
29. Next, use the same process to enter this XPath expression for the Bold property:

      if (rating = 'R') then 'bold' else ""
       

    
30. Click Preview ( ).

Our report now looks like this:

Figure 497. Finished Example Report

XML Whitepapers

Learn how XML can help you meet your business objectives by reading free XML Whitepapers covering XML, XML Schema, XQuery, SQL/XML, and FIXML technolgies employed in real world case studies.

EDI to XML

Using the DataDirect XML Converters EDI repository, the EDI to XML Conversion module is able to support dozens of EDI standard dialects and message types like EDIFACT, HL7, and X12.

XML Unicode Encoding

Stylus Studio supports over 300 different file encodings, including UTF-8, UTF-16, EUC-JP, SHIFT-JIS, and more, alowing you to work with any XML document. Robust text editors support standard editing features, and Sense:X intelligent auto-completion.

XML-DEV Blog

Join the XML Development discussion at XML-Dev - the hottest place to talk about XML technologies, trends, systems architecture and all the latest buzz. Bookmark this RSS and ATOM feed now!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member