[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] embedding contents of external css stylesheet
On Sun, Sep 21, 2003 at 09:18:36AM -0400, Denis Bradford wrote: > I would like to embed the contents of an external css stylesheet at > user.head.content. That is, instead of a link to the stylesheet (a la > html.stylesheet), I would like a document-level <style> block in the > head of the document. I want to pull the css rules in from an external, > shared file, rather than hardwiring them in the stylesheet. > > Anybody know how to do this? btw, the idea here is that the generated > html file can be moved around and viewed standalone - the external css > file is not always convenient. Add this to your customization layer: <xsl:template name="output.html.stylesheets"> <xsl:variable name="style" select="document($html.stylesheet)"/> <xsl:copy-of select="$style"/> </xsl:template> The template named 'output.html.stylesheets' handles the $html.stylesheet parameter when it is set. In this case, instead of outputting a <link> element, it copies the stylesheet file into a variable and outputs the variable's contents. The catch is that you have to add <style> tags to your css file: <style type="text/css"> [css stuff here] ... </style> That's because the document() function can only open XML files, so there must be start and end tags. But that is ok, since you want the styles to be enclosed in <style> tags in the HTML anyway. -- Bob Stayton 400 Encinal Street Publications Architect Santa Cruz, CA 95060 Technical Publications voice: (831) 427-7796 The SCO Group fax: (831) 429-1887 email: bobs@sco.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]