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.

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

Stylus Studio displays the XPath Editor dialog box.

26. 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 487. XPath Editor Dialog Box

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

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

    
29. Click Preview ( ).

Our report now looks like this:

Figure 488. Finished Example Report

XML-DEV Discussion Forum

XML-DEV is a leading technical forum for XML discussion and a valuable free XML learning resource. Subscribe to the XML-DEV email discussion forum today to help further your XML education.

Content Management

Build Content Management systems with Stylus Studio's powerful XML publishing tools that enable you to unlock and re-use valuable content from your enterprise information repositories.

Developer Resource Center: Learn XML and Stylus Studio

Learning XML is easy with Stylus Studio. Check out our free XML tutorials, XML whitepapers, online video demonstrations, XML examples and XML references and more.

XQuery Tutorial

This XQuery Tutorial is about "BUILDING XQUERY BASED WEB SERVICE AGGREGATION AND REPORTING APPLICATIONS".

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member