Brett
This should do what you need. The changes are that admonition.properties  
needs to be used in stead of graphical.admonition.properties.
 
Regards,
Dean Nelson
 
 
   <!-- 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="border">
<xsl:choose>
<xsl:when test="ancestor-or-self::note"     >1pt solid  blue</xsl:when>
<xsl:when test="ancestor-or-self::warning"  >1pt solid  red</xsl:when>
<xsl:otherwise>1pt solid  black</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-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-top">
<xsl:choose>
<xsl:when test="ancestor-or-self::note"     >1pt solid  blue</xsl:when>
<xsl:when test="ancestor-or-self::warning"  >1pt solid  red</xsl:when>
<xsl:otherwise>1pt solid  black</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute  name="border-left">
<xsl:choose>
<xsl:when test="ancestor-or-self::note"     >1pt solid  blue</xsl:when>
<xsl:when test="ancestor-or-self::warning"  >1pt solid  red</xsl:when>
<xsl:otherwise>1pt solid  black</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute  name="border-right">
<xsl:choose>
<xsl:when test="ancestor-or-self::note"     >1pt solid  blue</xsl:when>
<xsl:when test="ancestor-or-self::warning"  >1pt solid  red</xsl:when>
<xsl:otherwise>1pt solid  black</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>





In a message dated 4/29/2014 1:25:00 A.M. Pacific Daylight Time,  
[email protected] writes:

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,  <[email protected]> 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,
> [email protected]  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: [email protected]
>  For additional commands, e-mail:  [email protected]
>

Reply via email to