From:
<car...@te...> - 2004-06-16 14:52:49
|
Hello: I have modified the fo.xsl file adding a modified template (based on the docbook one) for note, important, warning, caution and tip elements for render them with a background color, i haven't done it in the best way but seems to work ;) , it's of interest here it's: <xsl:template match="note|important|warning|caution|tip"> <xsl:param name="node" select="."/> <xsl:variable name="color"> <xsl:choose> <xsl:when test="name($node)='note'">F0FFFF</xsl:when> <xsl:when test="name($node)='warning'">FFE4E1</xsl:when> <xsl:when test="name($node)='caution'">FFE4E1</xsl:when> <xsl:when test="name($node)='tip'">F0FFFF</xsl:when> <xsl:when test="name($node)='important'">FFE4E1</xsl:when> </xsl:choose> </xsl:variable> <fo:block background-color="#{$color}"> <xsl:call-template name="nongraphical.admonition"/> </fo:block> </xsl:template> Comments are welcome !! :D -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From:
<car...@te...> - 2004-06-18 11:37:55
|
Hello: Hope the above one is more correct, it's the same as the docbook stylesheet one but adding the background color: <xsl:template match="note|important|warning|caution|tip"> <xsl:param name="node" select="."/> <xsl:variable name="id"> <xsl:call-template name="object.id"/> </xsl:variable> <xsl:variable name="color"> <xsl:choose> <xsl:when test="name($node)='note'">F0FFFF</xsl:when> <xsl:when test="name($node)='warning'">FFE4E1</xsl:when> <xsl:when test="name($node)='caution'">FFE4E1</xsl:when> <xsl:when test="name($node)='tip'">F0FFFF</xsl:when> <xsl:when test="name($node)='important'">FFE4E1</xsl:when> </xsl:choose> </xsl:variable> <fo:block space-before.minimum="0.8em" space-before.optimum="1em" space-before.maximum="1.2em" start-indent="0.25in" end-indent="0.25in" background-color="#{$color}" id="{$id}"> <xsl:if test="$admon.textlabel != 0 or title"> <fo:block keep-with-next='always' xsl:use-attribute-sets="admonition.title.properties"> <xsl:apply-templates select="." mode="object.title.markup"/> </fo:block> </xsl:if> <fo:block xsl:use-attribute-sets="admonition.properties"> <xsl:apply-templates/> </fo:block> </fo:block> </xsl:template> -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Paul V. <pa...@vi...> - 2004-06-19 11:42:01
|
Hi Carlos, > Hope the above one is more correct, it's the same as the docbook > stylesheet one ...except that you sneakily merged two templates into one, and in doing so disabled graphical admonitions ;-) > but adding the background color: > > <xsl:template match="note|important|warning|caution|tip"> > <xsl:param name="node" select="."/> > <xsl:variable name="id"> > <xsl:call-template name="object.id"/> > </xsl:variable> > <xsl:variable name="color"> > <xsl:choose> > <xsl:when test="name($node)='note'">F0FFFF</xsl:when> > <xsl:when test="name($node)='warning'">FFE4E1</xsl:when> <snip> I think the colored background is a good idea, but only for non-graphical admonitions. (If there's an icon next to the admoniton the background coloring may ruin the appearance, and the icon already attracts the attention anyway.) So in my copy, I overrode the nongraphical.admonition template: <xsl:template name="nongraphical.admonition"> <xsl:variable name="id"> <xsl:call-template name="object.id"/> </xsl:variable> <xsl:variable name="color"> <xsl:choose> <xsl:when test="name()='note'">F0FFFF</xsl:when> <xsl:when test="name()='warning'">FFE4E1</xsl:when> <xsl:when test="name()='caution'">FFE4E1</xsl:when> <xsl:when test="name()='tip'">F0FFFF</xsl:when> <xsl:when test="name()='important'">FFE4E1</xsl:when> </xsl:choose> </xsl:variable> <fo:block space-before.minimum="0.8em" space-before.optimum="1em" space-before.maximum="1.2em" background-color="#{$color}" id="{$id}"> <fo:table> <fo:table-column/> <fo:table-body> <fo:table-row> <fo:table-cell padding="6pt"> <xsl:if test="$admon.textlabel != 0 or title"> <fo:block keep-with-next='always' xsl:use-attribute-sets="admonition.title.properties"> <xsl:apply-templates select="." mode="object.title.markup"/> </fo:block> </xsl:if> <fo:block xsl:use-attribute-sets="admonition.properties"> <xsl:apply-templates/> </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </fo:block> </xsl:template> I didn't add extra indentation because with a bg color I find it nicer if the admonition aligns with the surrounding blocks. The table is necessary because of the padding. If you don't use a table, the text aligns with the surroundings but the padding extends outwards, which I find ugly. Now you *can* compensate the padding with margins or indents, but alas... if you do that, admonitions belonging to already-indented blocks like listitems etc., will then OUTdent, because margins and indents turn out not to be relative to the block, but to the content region. (Maybe there's a simple way around this, but I don't know it...) If you don't want the padding, you also don't need the table. Greetings, Paul Vinkenoog |
From:
<car...@te...> - 2004-06-19 11:52:34
|
Hello: >...except that you sneakily merged two templates into one, and in >doing so disabled graphical admonitions ;-) > hehe ... :) ... i was interested only in the non-graphical ones :) >I think the colored background is a good idea, but only for >non-graphical admonitions. (If there's an icon next to the admoniton >the background coloring may ruin the appearance, and the icon already >attracts the attention anyway.) > Agree. >If you don't want the padding, you also don't need the table. > I will modify my local copy and rebuild the protocol document later today, thanks very much for your help (i have no experience with DocBook and XSL :) but looks nice) -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From:
<car...@te...> - 2004-06-19 13:16:08
|
Hello: > rebuild the protocol document later today, Done looks nice, i have updated the PDF of the protocol documentation into the CVS :) -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Paul V. <pa...@vi...> - 2004-06-19 14:36:37
|
Hi Carlos, > Done looks nice, i have updated the PDF > of the protocol documentation into the CVS :) It looks good, especially if you consider how disastrous our PDF rendering was only 2 weeks ago! At last we're on the right track :-) Greetings, Paul Vinkenoog |