I would like to create an xslt stylesheet to convert (simple) html to DOCBOOK (which will then be converted PDF via FO). All the basic formatting stuff works well. Now I want to have colors in the text. The HTML code looks like this:
<span style="color: #eag000;">colored text</span> or
<font color="#eag000">more colored text</font>
I've found some threads proposing to use
<emphasis role="red">colored text</emphasis>
in DOCBOOK, but the colors I've got are not just "red", but some random hex values.
What is the best way to get colored text in DOCBOOK (so that it's recognized by the later FO transformation)? Is it possible at all to achieve this, without modifying the DOCBOOK-to-FO transformation?
Thanks for your help!
Since DocBook doesn't have a way of recording the color to use with elements, I don't see how you will get what you want without modifying the DocBook-to-FO transformation.
If you want to extend DocBook to add your own attribute for the colour, you can. See "Adding Attributes" in http://www.docbook.org/tdg5/en/html/ch05.html
It's probably both simpler and more common to (mis)use the role
attribute, which is already allowed on (almost) all DocBook elements. You could then customise your stylesheet to do the right thing with the colour values in role
attributes.