Linking in Cascading Style Sheets

Because CSS now is the de facto standard for formatting in HTML, cascading style sheets are required in the HTML you output from XSLT. This means there are now two style sheets involved—an extensible one and a cascading one—each handling some of the details of the presentation of our data. So from now on, I will refer to a CSS style sheet as CSS and an XSLT style sheet as XSLT, avoiding the use of the term style sheet.

At the simplest level, you can add a CSS reference using a <link> element in your output HTML, by changing the <head> element of the sample XSLT, as shown in Listing 6.7.

Listing 6.7. Referencing a CSS Style Sheet from an HTML <HEAD> Element
 <head> <title><xsl:value-of select=”name” /></title> ...

Get Special Edition Using XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.