[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] reference value from XML document inside XSL for printing


Subject: Re: [xsl] reference value from XML document inside XSL for printing
From: "Stephen Ingram sbingram@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Jan 2015 07:16:18 -0000

On Mon, Jan 19, 2015 at 1:38 PM, Liam R E Quin liam@xxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> On Mon, 19 Jan 2015 21:12:27 -0000
> "Stephen Ingram sbingram@xxxxxxxxx" <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> > I'm using the <date></date> tags within my Docbook 5 XML document. I'd
> like
> > to include what appears between those tags inside the header of the
> > document when it prints out. I'm trying to accomplish this by referencing
> > the <date> tags inside my XSL (FO) document,
> [...]
>
> How *exactly* are you turning your DocBook XML document into an XSl-FO
> instance for printing?
>
> Most people use XSLT for this, and it ought to be simple enough to take
> the contents of the date element (XSLT deals with elements in a tree, not
> tags, for what it's worth) and to put that into static content in the page
> master.
>
> For searching for examples, note that really you are putting the contents
> of an element in the input document into the running header -- the fact it
> happens to be a date isn't relevant here. So I wouldn't mention "date" in
> your Google searches...
>

Yes, I did mistype that. I am actually using XSLT to try to accomplish
this. I'm using <xsl:template name="header.content"> and then using a
<xsl:choose> to select the position (left, center, right) and then trying
to place different elements there. For example, I'm suing the following to
include a logo:

<xsl:when test="$sequence='odd' and $position='center'">
    <fo:external-graphic content-height="34px">
        <xsl:attribute name="src">
            <xsl:call-template name="fo-external-image">
                <xsl:with-param name="filename"
select="$header.image.filename"/>
            </xsl:call-template>
        </xsl:attribute>
    </fo:external-graphic>
</xsl:when>

I'm specifying the actual image earlier in the template using a xsl:param
element.

I believe I know how to position items in the header as I've inserted an
image in the center, but I'm not sure how to pull the contents of the
element from the XML document itself. Everything else I've done is
specified in the XSLT document itself so it's easy to specify with a
xsl:param element. I'm sure getting the right Google search phrase is the
trick here, but I still haven't found that perfect combination yet.

Steve


Current Thread
Keywords