The CSS Output

Alongside the generated HTML one needs of course to produce CSS. Current Web practice is to use a mixture of separately-served CSS resources and CSS styles embedded within HTML itself. The primary tradeoff between using separate files and embedding is in bandwidth consumption when users visit multiple pages on the same site, or even the same page multiple times: a separate CSS file can then provide clear savings in bandwidth and in time to render the Web page. For the first time that a client loads a page, however, embedded styles for the first few elements that will be rendered on the page can reduce the time before the user can use the Web page. CSS styles embedded in HTML after the head, however, raise security questions outside the scope of this paper; we shall focus only on a separate CSS resource, created on the server as a standalone file.

In an XSLT stylesheet using CSS Within, you can call the css:gather template to produce the CSS; use this within an xsl:result-document element with method="text". In the future there may instead be a css:stream element for this purpose.