This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Custom fop header... again


Yes, you have to declare the namespace

xmlns:fo="http://www.w3.org/1999/XSL/Format"; in the starting "stylesheet"-element of your customization layer as you can see in fo/docbook.xsl in the DocBook stylesheet distribution.

If you want to use a namespace, you always have to declare it. You could do this within the element that uses it like that

<fo:external-graphic xmlns:fo="http://www.w3.org/1999/XSL/Format"; src="/Users/jacques/Documents/images/logo.png"/>

- but then you had to declare it every time you'd use another FO element.

If you declare it within the root element, it is valid for the whole stylesheet like xmlns:xsl="http://www.w3.org/1999/XSL/Transform";, which defines all the XSL-Elements (xsl:template, xsl:if and so on).

You could also declare the namespace with another identifier, say "FOO" like this xmlns:FOO="http://www.w3.org/1999/XSL/Format"; and you would then write <FOO:external-graphic src="/Users/jacques/Documents/images/logo.png"/>

You could even mix "fo" and "FOO", but this would be very confusing.

It's more likely you'll want to leave it as "fo" since this looks much more familiar and also a bit official :-) I've made the example just to give you some idea about this name space concept ;-)

Regards,
Gisbert Amm

christian brugeron wrote:
I think that you have to use docbook syntax for image inclusion, maybe not fo, or declare the namespace in your xsl

Bonjour Jacques


cb



Le 27 Jul 2004, à 13:07, Jacques a écrit :


Hello list,

After reading, and reading and reading again the Bob's document about
header.content, I made a try.

In my custom-layer.xsl file I first put this :

    <xsl:template name="header.content">
        <xsl:param name="pageclass" select="''"/>
        <xsl:param name="sequence" select="''"/>
        <xsl:param name="position" select="''"/>
        <xsl:param name="gentext-key" select="''"/>
        <xsl:choose>
            <xsl:when test="$sequence = 'first' and $position = 'left'">
                <xsl:text>FOO</xsl:text>
            </xsl:when>
        <xsl:choose/>
    </xsl:template>

    And every fist page of a chapter the word "FOO" appears on the top
left. YEAH ! Great victory for me :-)

But the target is to put a logo in this place so I have changed :

<xsl:text>FOO</xsl:text>

by :

<fo:external-graphic src="/Users/jacques/Documents/images/logo.png"/>

And... it doesn't work.

Using xsltproc to generate the fo file I have this error :

/Users/jacques/Documents/custom-layer.xsl:11: namespace error :
Namespace prefix fo on external-graphic is not defined
                                <fo:external-graphic
src="/Users/jacques/Documents/images/logo.png"/>

Did I have to use a <xmlns:...> statement somewhere ? And if yes where,
and which one ? I must admit that I haven't insterstood this name space
concept.

Thanks in advance for your help.
Jacques
--
Pour qu'il y ait le moins de mécontents possible, il faut toujours taper sur les mêmes



Christian Brugeron
Expert PDF/PostScript - Automatisation de l'édition - XML/XSLT/XSL-F
O


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]