[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Commands, image borders, and paper size
Hi Eitan, Some answers below. ----- Original Message ----- From: "Eitan Zabari" <eitanz@jungo.com> To: <docbook-apps@lists.oasis-open.org> Sent: Monday, February 12, 2007 7:00 AM Subject: [docbook-apps] Commands, image borders, and paper size > Hello Bob, > > Thank you for your answers - they were extremely helpful and I was able > to get the features working in no time. I have a few more, if I may. > > 1. I was able to use the entities as you explained, to create a "command" > that represents a product name. However, in LaTex we were able to pass > parameters to such a command. For example: > > \newcommand{\placediagram}[2] > { > \begin{figure}[H] > \center > \framebox{\includegraphics[keepaspectratio]{images/#1}} > \caption{#2} > \label{#1} > \end{figure} > } > > This way, we could write "\placediagram{<image name>}{<image caption>}" > > Can we do something like that with DocBook? XSL stylesheets accept command line parameters. If you set up entity content as an element that the stylesheet can match on, then the stylesheet can insert a parameter value. For example: <!ENTITY productname '<phrase role="productname"/>' > and place &productname; in your document content where you want the variable to resolve. Then you add this to your stylesheet: <xsl:template match="phrase[@role = 'productname']"> <xsl:value-of select="$product.name"/> </xsl:template> And then pass a parameter on the command line like product.name="ABC, Inc." The entity is resolved by the parser at runtime, before the stylesheet sees the file. However, this would not work for attribute values. If it is for an image fileref, you would need to handle it differently. Most attributes are not processed by a template, but @fileref is, so you can customize it. Use something like this in your document: <imagedata fileref="#product.name.image#"/> and add this template: <xsl:template match="@fileref"> <xsl:choose> <xsl:when test="string(.) = '#product.name.image#'"> <xsl:value-of select="$product.name.image"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template. No entity is involved, as it is just processing the string. For that matter, you don't really need an entity in the first example, you could just enter <phrase role="productname"/> in your document. > 2. Is there a way to add a simple line border to images at the > code/command level (and not graphically on the images)? There is no parameter for this, so you would need toc customize the template with match="mediaobject|mediaobjectco" in fo/graphics.xsl. In the fo:block, add a property like border="0.5pt solid black" > 3. When compiling A5 format, the paper size seems to be smaller (in PDF), > however the text is not resized, but rather spread to the next page, over > the header. A5 has a larger page total than its A4 counterpart. The stylesheet does not change any font sizes when the paper size changes. You might want to setup a separate customization layer for each page size you need, and place it in parameters for adjusting all sizes. Then each of those could import your main customization, which in turn imports docbook.xsl Bob Stayton Sagehill Enterprises DocBook Consulting bobs@sagehill.net
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]