[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Custom colors for admonitions
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
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]