New in StyleVision 2012 – Composite Styles for Enhanced Formatting
One of the more versatile features introduced in StyleVision 2012 is support for composite styles for output to RTF, Word, and PDF as well as HTML and Authentic electronic forms. This feature allows you to combine styles defined in an XML instance document with those you set in the report itself. You can also build a composite with XPath to control multiple style features of the same design element (e.g., font, background color, alignment).
Support for composite styles means that you can quickly and easily change the look of a design component by selecting an attribute from the XML instance file or by changing the XPath expression. This feature is used most often in cases where the XML document includes HTML fragments that contain style information – now you can use an XPath selector to extract style information from the HTML fragment and apply it directly to an output document.
Here for example we’ve used XMLSpy, Altova’s XML editor and development environment, to create an XML instance file containing the contents of a music library. (We also created the Schema in XMLSpy.)
The StyleIt attribute of the Recording element pictured below includes formatting instructions for this individual recording – according to our file the Fun Factory recording should be red and bolded.
Now we can move to StyleVision and start creating a design based on our XML instance document.
All we need to do to apply the formatting instructions in the XML instance document is to call the StyleIt attribute from the composite style drop down in the Properties pane in our StyleVision design.
The Fun Factory recording appears in red bold in the resulting output.
We can also choose to ignore the formatting instructions from the instance file and provide our own.
Here we’ve replaced the StyleIt attribute in the drop down list with an XPath if-then-else statement that assigns formatting based on an attribute of the Recording element called PlaylistCode – party tunes are in blue Papyrus 12 point font, easy listening favorites are in maroon Pristina 14 point font, and background music by default is in green Onyx 14 point font.
Here’s what the output file looks like now.
Support for composite styles is only one of the new styling features in the StyleVision 2012 stylesheet and report designer. Click here to read more about the new features across the entire Altova product line.
Have you used created a great project using the StyleVision stylesheet and report designer or any of Altova’s other tools? Want to show it off? Please share your story with other Altova users by commenting on this blog post. If you think it would make a great case study please visit the Altova case studies page – if we use your story you’ll receive a $200 Amazon gift card. We’d love to hear from you!