[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Background for programlisting
Hello Bob, thanks. Second solution works well from me. Thanks a lot, Lars 2012/6/15 Bob Stayton <bobs@sagehill.net>: > Hi, > Yes, that is possible. In the template matching on 'programlisting' in > fo/verbatim.xsl, you'll see this: > > <xsl:when test="$shade.verbatim != 0"> > <fo:block xsl:use-attribute-sets="monospace.verbatim.properties > shade.verbatim.style"> > > And in the template matching on 'literallayout' you will see this: > > <xsl:when test="$shade.verbatim != 0"> > <fo:block xsl:use-attribute-sets="verbatim.properties > shade.verbatim.style"> > > As you can see, the shade.verbatim.style attribute set is used for both > literallayout and programlisting (and screen and synopsis). > > So there are two approaches to applying shade for programlisting only: > > 1. Make each attribute in the shade.verbatim.style attribute-set > conditional on the context element: > > <xsl:attribute name="background-color"> > <xsl:choose> > <xsl:when test="self::d:programlisting">>#F0F0F0</xsl:when> > <xsl:otherwise>inherit</xsl:otherwise> > </xsl:choose> > </xsl:attribute> > [repeat for the other attributes] > > 2. Move the attributes from shade.verbatim.style to > monospace.verbatim.properties. You lose the ability to turn off the shading > with the 'shade.verbatim' parameter, since that attribute set is used when > shade.verbatim=0. But if your style always calls for shaded programlisting, > you may not need that param. > > Bob Stayton > Sagehill Enterprises > bobs@sagehill.net > > > ----- Original Message ----- From: "Lars Vogel" <lars.vogel@googlemail.com> > To: <DeanNelson@aol.com> > Cc: <docbook-apps@lists.oasis-open.org> > Sent: Friday, June 15, 2012 2:33 AM > Subject: Re: [docbook-apps] Background for programlisting > > > > Hi Dean, > > thanks again. Is it possible to activate the shade.verbatim only for > programlisting? > > <xsl:param name="shade.verbatim" select="1"></xsl:param> > > I also use <literallayout> (many for quotes and titels) and I would > prefer not to have the background set for this one. > > Best regards, Lars > > 2012/6/15 <DeanNelson@aol.com>: >> >> Lars, >> Not sure what happened in your layer, but here is what I use for >> progrmalisting shading. >> >> 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" > >> >> <xsl:param name="shade.verbatim" select="1"></xsl:param> >> <xsl:attribute-set name="shade.verbatim.style"> >> <xsl:attribute name="font-family"> >> <xsl:value-of select="$monospace.font.family"/> >> </xsl:attribute> >> <xsl:attribute name="font-size"> >> <xsl:value-of select="$body.font.master * 0.9"/> >> <xsl:text>pt</xsl:text> >> </xsl:attribute> >> <xsl:attribute name="border-color">#0000FF</xsl:attribute> >> <xsl:attribute name="border-style">solid</xsl:attribute> >> <xsl:attribute name="border-width">heavy</xsl:attribute> >> <xsl:attribute name="background-color">#F0F0F0</xsl:attribute> >> <xsl:attribute name="padding">10pt</xsl:attribute> >> <xsl:attribute name="wrap-option">wrap</xsl:attribute> >> </xsl:attribute-set> >> >> <!-- Use this if you need line breaks in long listings >> <xsl:attribute-set name="monospace.verbatim.properties"> >> <xsl:attribute name="wrap-option">wrap</xsl:attribute> >> </xsl:attribute-set> >> --> >> >> <!-- =================== Program listing shading =================== >> --> >> <xsl:attribute-set name="monospace.verbatim.properties" >> use-attribute-sets="verbatim.properties"> >> <xsl:attribute name="font-family"> >> <xsl:value-of select="$monospace.font.family"/> >> </xsl:attribute> >> <xsl:attribute name="font-size"> >> <xsl:value-of select="$body.font.master * 0.9"/> >> <xsl:text>pt</xsl:text> >> </xsl:attribute> >> <xsl:attribute name="border-color">#0000FF</xsl:attribute> >> <xsl:attribute name="border-style">solid</xsl:attribute> >> <xsl:attribute name="border-width">heavy</xsl:attribute> >> <xsl:attribute name="background-color">#F0F0F0</xsl:attribute> >> <xsl:attribute name="padding">10pt</xsl:attribute> >> <xsl:attribute name="wrap-option">wrap</xsl:attribute> >> <xsl:attribute name="hyphenation-character">►</xsl:attribute> >> <!--FOP doesn't support this yet? --> >> </xsl:attribute-set> >> >> >> </xsl:stylesheet> >> >> >> >> In a message dated 6/14/2012 4:03:24 P.M. Pacific Daylight Time, >> lars.vogel@googlemail.com writes: >> >> Hello, >> >> I wanted to add a background color to my programming listings and >> found an old post from Bob in which he suggested to add the following >> to the customizing layer: >> >> <xsl:attribute-set name="shade.verbatim.properties"> >> border-color="thin black ridge" >> background-color="silver" >> </xsl:attribute-set> >> >> If I do this, I get an error: >> >> [xslt] Unknown file:61:9: Fatal Error! Error reported by XML >> parser Cause: org.xml.sax.SAXParseException; lineNumber: 61; >> columnNumber: 9; expected '"' or "'" (found "b") >> [xslt] Failed to process null >> >> BUILD FAILED >> /home/vogella/workspace/docu/de.vogella.publishing/buildpdf.xml:294: >> javax.xml.transform.TransformerConfigurationException: Failed to parse >> stylesheet >> >> Anyone knows what I'm doing incorrect? >> >> Best regards, Lars >> >> -- >> Lars >> http://www.vogella.com - Eclipse, Android and Java Tutorials >> http://www.twitter.com/vogella - Lars on Twitter >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org >> >> >> In a message dated 6/14/2012 4:03:24 P.M. Pacific Daylight Time, >> lars.vogel@googlemail.com writes: >> >> Hello, >> >> I wanted to add a background color to my programming listings and >> found an old post from Bob in which he suggested to add the following >> to the customizing layer: >> >> <xsl:attribute-set name="shade.verbatim.properties"> >> border-color="thin black ridge" >> background-color="silver" >> </xsl:attribute-set> >> >> If I do this, I get an error: >> >> [xslt] Unknown file:61:9: Fatal Error! Error reported by XML >> parser Cause: org.xml.sax.SAXParseException; lineNumber: 61; >> columnNumber: 9; expected '"' or "'" (found "b") >> [xslt] Failed to process null >> >> BUILD FAILED >> /home/vogella/workspace/docu/de.vogella.publishing/buildpdf.xml:294: >> javax.xml.transform.TransformerConfigurationException: Failed to parse >> stylesheet >> >> Anyone knows what I'm doing incorrect? >> >> Best regards, Lars >> >> -- >> Lars >> http://www.vogella.com - Eclipse, Android and Java Tutorials >> http://www.twitter.com/vogella - Lars on Twitter >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > > > > -- > Lars > http://www.vogella.com - Eclipse, Android and Java Tutorials > http://www.twitter.com/vogella - Lars on Twitter > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > > -- Lars http://www.vogella.com - Eclipse, Android and Java Tutorials http://www.twitter.com/vogella - Lars on Twitter
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]