Thank you again, Stefan!
Yes, I solved the problem of extracting the exact color codes using
substring-before and substring-after, so this is not a problem.
I will try to explain again.
The default template for <phrase> creates
<span class="phrase">some text</span>
in HTML output.
If we specify the role "color:red;" for a <phrase>, then by default the
following output will be created:
<span class="color:red;">some text</span>
I should probably avoid creating a new class by specifying
phrase.propagates.style=0. Then even with role="color:red;" the output will
look like
<span class="phrase">some text</span>
I can extract this "red" from the role's value, and I don't care about the
class name (because I'm not going to define a new style in CSS).
But the question is, how to add a *style* to the <span> using stylesheet
customization at all?
--
Ekaterina Shikareva.
-----Original Message-----
From: Stefan Knorr [mailto:[email protected]]
Sent: Montag, 15. August 2016 16:41
To: Shikareva, Ekaterina
Cc: [email protected]
Subject: RE: [docbook-apps] user-defined text/background color in HTML output
Hi Ekaterina,
as far as I understood your original mail, you managed to get your list of
values parsed in the case of XSL-FO.
If not, you will have to write some XSLT to parse your pseudo-CSS...
Expect this to be a bit hard -- XSLT (at least, 1.0) is not really made for
string manipulation, and adding some error tolerance may bloat your code even
more.
Presumably, that parser would be based on first looking for a ";" , splitting
that string off, then looking where the ":" within your split-off string is.
And then you would continue...
If you are looking for inspiration, in your local DocBook stylesheets
installation, take a look at lib/lib.xsl, and specifically the template
"pi-attribute". This template solves a similar issue, trying to figure out
constructs like 'attribute="value"'.
You can also take a look at my horrible old code to parse things like
'attribute = value;' [1].
You would then have to add in a list of attributes to allow and a list of color
names to allow. And then match against those.
Hth,
Stefan.
[1]
https://github.com/openSUSE/suse-xsl/blob/88451ccc3006b20900e0b28371ba8805362ed819/suse2013/fo/l10n.properties.xsl#L187
--- .
SUSE Linux GmbH. Geschäftsführer: Felix Imendörffer, Jane Smithard,
Graham Norton. HRB 21284 (AG Nürnberg).
________________________________
This e-mail and any attachment(s) are intended only for the recipient(s) named
above and others who have been specifically authorized to receive them. They
may contain confidential information. If you are not the intended recipient,
please do not read this email or its attachment(s). Furthermore, you are hereby
notified that any dissemination, distribution or copying of this e-mail and any
attachment(s) is strictly prohibited. If you have received this e-mail in
error, please immediately notify the sender by replying to this e-mail and then
delete this e-mail and any attachment(s) or copies thereof from your system.
Thank you.