OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Re: generating a custom css to epub3 -- how? (+ italics?)


Hi Robert,
Sorry about the confusion.  These steps should do what you want:

1. In the document source directory, create a file named docbook2.css.xml with this content:

<?xml version="1.0"?>
<style>
<xi:include href="docbook2.css" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</style>

The href path to your docbook2.css can be any URI relative to the source file directory.

2.  In your epub customization layer, set this param:

<xsl:param name="custom.css.source">docbook2.css.xml</xsl:param>

With these settings, you should still get the default docbook-epub.css file, and also your custom docbook2.css file in your output directory. Both should be referenced by all the .xhtml files with <link> elements, and should be included in the .opf file as individual <item> elements. With these settings, your CSS files is a supplement to the default CSS styles. If you want to completely replace the default CSS, then set the stylesheet param 'docbook.css.source' to blank.



Here is what is going on. Prior to the addition of this feature to generate a CSS file, you could specify the name of your CSS file with the 'html.stylesheet' parameter, but you always had to copy the actual CSS file to the output directory as a separate step. With this feature, you don't need that extra step.

For several reasons, I didn't want to see CSS styles contained in the XSL customization file itself . But while XSLT can generate a text output file, the XSLT document() function cannot read a text input file such as a CSS file, as that function only works with well-formed XML files. So wrapping the CSS text in a <style> element made it an XML file that could be opened with document(). So the docbook2.css.xml file is not a CSS file; it is an XML file containing CSS text. The outer <style> element is simply stripped off when writing out the text CSS file.

The XInclude trick allows you to develop and test a real CSS file such as docbook2.css, and then import it as part of the CSS source file. That works because XInclude has a parse="text" feature.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- From: "Robert Nagle" <idiotprogrammer@gmail.com>
To: <docbook-apps@lists.oasis-open.org>
Cc: "Dave Pawson" <davep@dpawson.co.uk>
Sent: Wednesday, July 18, 2012 12:13 AM
Subject: [docbook-apps] Re: generating a custom css to epub3 -- how? (+ italics?)


Ok, I haven't achieved my goal, which is causing docbook2.css to be
copied into the target directory. The xhtml references the
docbook2.css file though.

Ok, Dave are you saying that I need to preprocess the xsl
customization layer in order to expand the xinclude and drop the css
stuff inside? Then, after I have done this, I will have to process it
again? (something akin to two pass processing).

How would I do this with Saxon (if it's possible)? Would I need to do
two-pass processing (where I process it into an intermediary file?

***************************************


The problem is that I don't know what's going on with these
   parameters, and what Bob's answer means. Am I including a css file or
   an xml file which contains css information?

Dave Pawson replied:

The 'text' bit

<xi:include href="docbook2.css" parse="text"
says that it is plain text, i.e. not XML.
Hence as the extension says, you're pulling in css.





--
Robert Nagle
6121 Winsome Ln #56C, Houston TX 77057-5581
(H) 713 893 3424/ (W) 832-251-7522 Carbon Neutral Since Jan 2010
http://www.robertnagle.info

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org






[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]