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] Custom colors for admonitions


Hi Bob,

Thanks, that makes perfect sense. I've been looking at docbook.org
quite a bit lately, how embarrassing to miss that difference. It works
how I expected now.

Sorry for bothering everyone with my poor typing skills.


Thank you,
Brett

On 1 May 2014 08:32, Bob Stayton <bobs@sagehill.net> wrote:
> Hi Brett,
> Actually, you almost had it correct in your first stylesheet.  The problem
> was a typo in the namespace declaration:
>
> xmlns:d="http://docbook/org/ns/docbook";  [can you spot it?]
>
> This meant the d: namespace in your stylesheet did not match up with the
> namespace in the document, so the self::d:warning did not match.  With the
> correct namespace declaration, your version works.
>
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
>
>
> On 4/29/2014 10:24 PM, Brett Davis wrote:
>>
>> Dean, you're a genius!
>>
>> If I use
>>
>> <xsl:when test="name(.) = 'warning'">red</xsl:when>
>>
>> instead of
>>
>> <xsl:when test="self::d:warning">red</xsl:when>
>>
>> it works! Thanks for your help, I didn't know much about
>> <xsl:message>. It let me do some more testing and find something that
>> matched. Problem solved.
>>
>>
>> Thanks,
>> Brett
>>
>> On 30 April 2014 15:09,  <DeanNelson@aol.com> wrote:
>>>
>>> Brett,
>>> It may be time to do some debugging with <xsl:message> statements to see
>>> what is really going on. Do you know that your template is actually
>>> activated?
>>>
>>> Also, what command line arguments are you using with XSLTPROC?
>>>
>>> Dean
>>>
>>> In a message dated 4/29/2014 6:29:32 P.M. Pacific Daylight Time,
>>> brettd43@gmail.com writes:
>>>
>>> Hi Frank,
>>>
>>> I'm using xsl-ns-1.78.1/fo/docbook.xsl as my base style sheet, and as
>>> far as I know it's DocBook 5.0. I've had errors caused by missing
>>> namespaces before, so I'm fairly sure that it's supposed to be there.
>>> I've also tried leaving out the namespace ("self::warning") just to be
>>> sure, and that gives the same result.
>>>
>>> So far I've tried:
>>> test="self::d:warning"
>>> test="self::warning"
>>> test="ancestor-or-self::d:warning"
>>> test="ancestor-or-self::warning"
>>>
>>> I don't know any other options to try.
>>>
>>> I just thought: maybe it's a problem with my version of xsltproc
>>> (libxslt-1.1.26.win32), or maybe how I'm using it. That would be a
>>> question for another mailing list...
>>>
>>>
>>> Thanks,
>>> Brett
>>>
>>> On 30 April 2014 02:23, Frank Arensmeier <farensmeier@gmail.com> wrote:
>>>>
>>>> Hi Brett!
>>>>
>>>> Which version of the stylesheets are you using? There is a version that
>>>> uses a namespace and one that doesn’t.
>>>>
>>>> /frank
>>>>
>>>> 29 apr 2014 kl. 10:24 skrev Brett Davis <brettd43@gmail.com>:
>>>>
>>>>> Hi Dean,
>>>>>
>>>>> Thanks for the speedy answer. Unfortunately, that doesn't let me give
>>>>> each admonition a different color either.
>>>>>
>>>>> The part that's not working for me is the "choose" block, where a
>>>>> warning should have red lines and a note should have blue lines.
>>>>> Whether I use test="self::d:warning" or
>>>>> test="ancestor-or-self::warning", all admonitions end up in my PDF as
>>>>> the default color, which is black.
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Brett
>>>>>
>>>>> On 29 April 2014 15:51,  <DeanNelson@aol.com> wrote:
>>>>>>
>>>>>> Brett,
>>>>>> The simple answer is to add
>>>>>> <xsl:attribute name="border">1pt solid blue</xsl:attribute>
>>>>>> or a variation of it.
>>>>>>
>>>>>> However, I have found that you will need to also deal with the title
>>>>>> box
>>>>>> as
>>>>>> well or it will look a bit weird. So below you will see my admonition
>>>>>> section that you should be able to modify to suit your needs.
>>>>>>
>>>>>> Regards
>>>>>> Dean Nelson
>>>>>>
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>>>>>> version="1.0"
>>>>>>     xmlns:fo="http://www.w3.org/1999/XSL/Format"; >
>>>>>>
>>>>>>
>>>>>>     <!-- Admonitions -->
>>>>>>
>>>>>>     <xsl:param name="admon.graphics" select="'1'"/>
>>>>>>     <xsl:param name="admon.textlabel" select="'1'"/>
>>>>>>     <xsl:param name="admon.graphics.extension" select="'.svg'"/>
>>>>>>     <xsl:param name="admon.graphics.path"
>>>>>>
>>>>>> select="'http://docbook.sourceforge.net/release/xsl/current/images/'"/>
>>>>>>
>>>>>>     <!--  Normal -->
>>>>>>     <xsl:attribute-set name="admonition.properties">
>>>>>>         <xsl:attribute name="background-color">
>>>>>>             <xsl:choose>
>>>>>>                 <xsl:when test="ancestor-or-self::tip"
>>>>>>>
>>>>>>> #FFFFFF</xsl:when>
>>>>>>
>>>>>>                 <xsl:when test="ancestor-or-self::note"
>>>>>>>
>>>>>>> #FFFFFF</xsl:when>
>>>>>>
>>>>>>                 <xsl:when
>>>>>> test="ancestor-or-self::important">#B5FFB5</xsl:when>
>>>>>>                 <xsl:when test="ancestor-or-self::caution"
>>>>>>>
>>>>>>> #FAFA8C</xsl:when>
>>>>>>
>>>>>>                 <xsl:when test="ancestor-or-self::warning"
>>>>>>>
>>>>>>> #FFADAD</xsl:when>
>>>>>>
>>>>>>                 <xsl:otherwise>#000000</xsl:otherwise>
>>>>>>             </xsl:choose>
>>>>>>         </xsl:attribute>
>>>>>>         <xsl:attribute
>>>>>> name="keep-together.within-column">always</xsl:attribute>
>>>>>>         <xsl:attribute name="padding">5pt</xsl:attribute>
>>>>>>         <xsl:attribute name="padding-top">-5pt</xsl:attribute>
>>>>>>         <xsl:attribute name="border">1pt solid blue</xsl:attribute>
>>>>>>      </xsl:attribute-set>
>>>>>>
>>>>>>     <xsl:attribute-set name="admonition.title.properties">
>>>>>>         <xsl:attribute
>>>>>> name="keep-together.within-column">always</xsl:attribute>
>>>>>>         <xsl:attribute name="background-color">#E0E0E0</xsl:attribute>
>>>>>>         <xsl:attribute name="text-align">left</xsl:attribute>
>>>>>>         <xsl:attribute name="padding">5pt</xsl:attribute>
>>>>>>           <!-- <xsl:attribute name="border">1pt solid
>>>>>> blue</xsl:attribute>
>>>>>> removed to avoid double line -->
>>>>>>         <xsl:attribute name="border-top">1pt solid
>>>>>> blue</xsl:attribute>
>>>>>>         <xsl:attribute name="border-left">1pt solid
>>>>>> blue</xsl:attribute>
>>>>>>         <xsl:attribute name="border-right">1pt solid
>>>>>> blue</xsl:attribute>
>>>>>>     </xsl:attribute-set
>>>>>>
>>>>>> </xsl:stylesheet>
>>>>>>
>>>>>>
>>>>>>
>>>>>> In a message dated 4/28/2014 7:24:58 P.M. Pacific Daylight Time,
>>>>>> brettd43@gmail.com writes:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'd like to give each admonition a border of its own color. I found a
>>>>>> question where using a "choose" block was suggested when customizing
>>>>>> the attribute-set for "graphical.admonition.properties". I've tried
>>>>>> that, and while I can change the attributes in the attribute-set, my
>>>>>> tests in the "choose" block never match any admonitions. They all get
>>>>>> the value given in the "otherwise" block. Is there something I should
>>>>>> be using instead of test="self::d:warning", or have I screwed up
>>>>>> somewhere else?
>>>>>>
>>>>>> I'm using DocBook 5.0, libxslt-1.1.26.win32, fop-1.1 on Windows Vista
>>>>>> 64 bit Ultimate.
>>>>>>
>>>>>>
>>>>>> Here's testbook.xml:
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <article xmlns="http://docbook.org/ns/docbook"; version="5.0">
>>>>>>     <title>A Small Example</title>
>>>>>>
>>>>>>     <section>
>>>>>>         <para>If everything goes as planned, the warning below will
>>>>>> have a red line above and below it, and the note will have blue lines.
>>>>>> If not, they'll both have black lines.</para>
>>>>>>
>>>>>>         <warning>
>>>>>>             <para>This is a warning!</para>
>>>>>>         </warning>
>>>>>>
>>>>>>         <note>
>>>>>>             <para>This is just a note.</para>
>>>>>>         </note>
>>>>>>
>>>>>>         <para>Ok, black lines it is.</para>
>>>>>>     </section>
>>>>>> </article>
>>>>>>
>>>>>>
>>>>>> Here's testStylesheet.xsl:
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>>>>>> xmlns:fo="http://www.w3.org/1999/XSL/Format";
>>>>>> xmlns:d="http://docbook/org/ns/docbook"; version="1.0">
>>>>>>     <xsl:import
>>>>>> href="D:/sdk/docbook/docbook-xsl-ns-1.78.1/fo/docbook.xsl"/>
>>>>>>
>>>>>>     <xsl:param name="paper.type">A4</xsl:param>
>>>>>>
>>>>>>     <!-- customise admonitions -->
>>>>>>     <xsl:param name="admon.graphics" select="1"/>
>>>>>>     <xsl:param name="admon.graphics.path">images/</xsl:param>
>>>>>>     <xsl:param name="admon.graphics.extension">.png</xsl:param>
>>>>>>
>>>>>>     <xsl:attribute-set name="graphical.admonition.properties">
>>>>>>         <xsl:attribute name="border-color">
>>>>>>             <xsl:choose>
>>>>>>                 <xsl:when test="self::d:warning">red</xsl:when>
>>>>>>                 <xsl:when test="self::d:note">blue</xsl:when>
>>>>>>                 <xsl:otherwise>black</xsl:otherwise>
>>>>>>             </xsl:choose>
>>>>>>         </xsl:attribute>
>>>>>>         <xsl:attribute name="border-top">1pt solid</xsl:attribute>
>>>>>>         <xsl:attribute name="border-bottom">1pt solid</xsl:attribute>
>>>>>>     </xsl:attribute-set>
>>>>>> </xsl:stylesheet>
>>>>>>
>>>>>>
>>>>>> I'm currently writing in Notepad++ and building using a .bat file:
>>>>>>
>>>>>> D:\sdk\docbook\libxslt-1.1.26.win32\bin\xsltproc.exe --output
>>>>>> testbook.fo testStylesheet.xsl testbook.xml
>>>>>>
>>>>>> D:\sdk\docbook\fop-1.1\fop.bat -fo testbook.fo -pdf testbook.pdf
>>>>>>
>>>>>>
>>>>>> I'm new to DocBook, so I'm probably making a stupid mistake somewhere.
>>>>>> Any help would be much appreciated.
>>>>>>
>>>>>> Thanks,
>>>>>> Brett
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>>>>> For additional commands, e-mail:
>>>>>> docbook-apps-help@lists.oasis-open.org
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>>>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> 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]