Thanks for your files, David. They worked fine with my XML source and gave
colored text.
The problem lies in our build system. We use some scripts to pre-process the
XML before sending to xsltproc. They are doing something to legalnotice
elementswhich means that legalnotice/para attributes are not matched.
However, attributes on legalnotice are matched.
Until I get to the bottom of this, I can use the following workaround.
Multiple legalnocices are allowed in bookinfo, so I can work at block level
on the legalnotice that I want to mark in colored text:
XML:
<legalnotice role="draft">
<para/>
</legalnotice>
XSL:
<xsl:template match="legalnotice[@role='draft']/para">
<fo:block color="red">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
David Cramer wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Could you post an example of your DocBook and customization? The
> attached simple test works for me even without doing any extra modes.
>
> David
>
> On 10/07/2011 12:22 PM, michael mclaughlin wrote:
>> No success using the "titlepage.mode" mode.
>>
>> --- On Fri, 7/10/11, David Cramer <[email protected]> wrote:
>>
>>> From: David Cramer <[email protected]>
>>> Subject: Re: [docbook-apps] Marking paras in colored text
>>> To: [email protected]
>>> Date: Friday, 7 October, 2011, 13:14
>> Try making a a second copy of those templates with
>> mode="titlepage.mode" (i.e. add that attribute to the
>> xsl:template
>> element). I haven't tested that, but it should catch most
>> of your
>> titlepage content. You may also have to add templates in
>> other modes
>> (e.g. mode="book.titlepage.recto.mode"), but I'll have to
>> do some
>> experiments to confirm my understanding of what's going on
>> in the
>> titlepage system.
>>
>> Let me know what happens with that. I'll play around with
>> it later when
>> I have some time too.
>>
>> David
>>
>> On 10/07/2011 06:29 AM, mike 675 wrote:
>>>>>
>>>>> I tried your text() match code.
>>>>> It works fine for the most part.
>>>>> But I was unable to get it to work on elements in the
>> titlepage section of a
>>>>> book or article.
>>>>> For example, I want to display some
>> legalnotice/para elements in red if
>>>>> they have a role="draft" attribute.
>>>>>
>>>>> Mike
>>>>>
>>>>> David Cramer wrote:
>>>>>>
>>>>> This [1] message provides an alternative approach that
>> will change the
>>>>> color of text based on an attributes on any element.
>> An advantage to
>>>>> this approach is that it only requires the addition of
>> a few templates
>>>>> rather than the modifications of many existing
>> templates (which is much
>>>>> harder to maintain when you adopt a new release of the
>> base xsls).
>>>>>
>>>>> David
>>>>>
>>>>> [1]
>>>>> http://lists.oasis-open.org/archives/docbook-apps/201108/msg00100.html
>>>>>
>>>>> On 10/06/2011 10:34 AM, Bob Stayton wrote:
>>>>>>>> Good try, but not quite. 8^)
>>>>>>>> You will lose some features if you
>> do it that way. To customize, a
>>>>>>>> better practice is to find the base
>> template for that element that
>>>>>>>> already exists in the DocBook stylesheets,
>> copy it to your customization
>>>>>>>> layer, and modify the match attribute and
>> anything you want in the body
>>>>>>>> of the template. You'll see that the
>> base template for match="para"
>>>>>>>> uses fo:block instead of fo:inline.
>> You can add your color to the
>>>>>>>> fo:block.
>>>>>>>>
>>>>>>>> Bob Stayton
>>>>>>>> Sagehill Enterprises
>>>>>>>> [email protected]
>>>>>>>>
>>>>>>>>
>>>>>>>> ----- Original Message ----- From: "mike
>> 675" <[email protected]>
>>>>>>>> To: <[email protected]>
>>>>>>>> Sent: Thursday, October 06, 2011 8:16 AM
>>>>>>>> Subject: [docbook-apps] Marking paras in
>> colored text
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> I want to find all paras marked as
>> role="high" and render them as red
>>>>>>>>> text in
>>>>>>>>> FO output.
>>>>>>>>>
>>>>>>>>> http://www.sagehill.net/docbookxsl/CustomInlines.html
>> shows how to do
>>>>>>>>> this
>>>>>>>>> sort of thing when matching on inline
>> text. Is it possible at block
>>>>>>>>> level?
>>>>>>>>>
>>>>>>>>> Here is my first attempt:
>>>>>>>>>
>>>>>>>>> <xsl:template
>> match="para[@role='high']"
>>>>>>>>> <fo:inline color="red">
>>>>>>>>> <xsl:apply-templates
>> />
>>>>>>>>> </fo:inline>
>>>>>>>>> </xsl:template>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://old.nabble.com/Marking-paras-in-colored-text-tp32600589p32600589.html
>>>>>>>>>
>>>>>>>>> Sent from the docbook apps mailing
>> list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJOkLBYAAoJEMHeSXG7afUhDpMH/3ztJm5+ofhFQDLfTH8vtMi9
> BD8VRaekNKj5mJIroULmxEVVXlfk8HVqwIiPXdhMIn9hTeVDZqHm2c0Fj9EebHR1
> JU9WTuNpKO1i8yTpED2MjsrMOvgYUnyCXm/hWCXB3j5r6FTHB+7pO7XGo1AUhLLo
> xZPFrzBpRemrUtOwk6hbLozy+DWinQFUDok8+kMh1lWg9jRlpV8l7CwnnFJ9wYS4
> x+279kFltYzWjbKYCTpLyxgr3TzlHk2234DwkRs+bi+mecjAE7G1k66vO4F2ihBI
> kqxUjv2I1qcbv2p8VE0V3+N+fHQW8aZW9c6Y9SOI/C0rfNZj/OB5V7Sf0qPqnO8=
> =/tBL
> -----END PGP SIGNATURE-----
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
--
View this message in context:
http://old.nabble.com/Marking-paras-in-colored-text-tp32600589p32622825.html
Sent from the docbook apps mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]