Customizing footers in output PDF

Hi, all. I confess that I'm something of an XSLT newbie. I'm working on customizing the output footers for our PDF documentation, and I'm having a difficult time of selecting the appropriate elements using XSLT. I'm trying to use the pagesetup.xsl stylesheet as a template, and I've been doing some work trying to construct the appropriate <xsl:value-of> selection. It has been somewhat difficult to use what should be a very simple selection: <xsl:value-of select="book/info/productname"/> The problem is that "book" no longer lives in the default namespace, but (it seems) in the "d" namespace: <xsl:stylesheet exclude-result-prefixes="d" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" I've tried removing the "exclude-result-prefixes" item and trying several variations on the above value-of query: <xsl:value-of select="d:book/info/productname"/> <xsl:value-of select="d:/book/info/productname"/> <xsl:value-of select="d:book/d:info/d:productname"/> <xsl:value-of select="d:productname"/> And the like. I know that the rule is being triggered because I'm getting textual output in the resulting PDF. But so far I'm mystified about how to go about modifying the header with the product name and version. I am nearly certain the issue is namespace related, because I'm able to get xsltproc to transform the xml file using pretty trivial xsl. I've attached both. I ran: xsltproc test.xsl 00_XBinder_Master.xml I'm using Saxon with Oxygen for the transformation. Best, Ethan Metsger -- Objective Systems, Inc. REAL WORLD ASN.1 AND XML SOLUTIONS Tel: +1 (484) 875-9841 Fax: +1 (484) 875-9830 Toll-free: (877) 307-6855 (USA only) http://www.obj-sys.com

Ethan Metsger wrote:
Hi, all.
I confess that I'm something of an XSLT newbie. I'm working on customizing the output footers for our PDF documentation, and I'm having a difficult time of selecting the appropriate elements using XSLT.
I'm trying to use the pagesetup.xsl stylesheet as a template, and I've been doing some work trying to construct the appropriate <xsl:value-of> selection. It has been somewhat difficult to use what should be a very simple selection:
<xsl:value-of select="book/info/productname"/>
The problem is that "book" no longer lives in the default namespace, but (it seems) in the "d" namespace: It is in the http://docbook.org/ns/docbook namespace. You have default namespace declaration in the xml file: xmlns="http://docbook.org/ns/docbook". This makes all element in the document not explicitly prepended with namespace have the default namespace. But this is not a problem. This is how oXygen knows that this is docbook file.
<xsl:stylesheet exclude-result-prefixes="d" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook"
I've tried removing the "exclude-result-prefixes" item and trying several variations on the above value-of query:
<xsl:value-of select="d:book/info/productname"/> <xsl:value-of select="d:/book/info/productname"/> <xsl:value-of select="d:book/d:info/d:productname"/> <xsl:value-of select="d:productname"/> Only the third is the correct one. This is what is in you xsl and it is fine. I tried to run in oXygen and it grabbed the productname.
And the like. I know that the rule is being triggered because I'm getting textual output in the resulting PDF. But so far I'm mystified about how to go about modifying the header with the product name and version. I am nearly certain the issue is namespace related, because I'm able to get xsltproc to transform the xml file using pretty trivial xsl. Now for PDF transformation your xsl is not correct. It is outputting HTML and you need FO. To get the correct footer in PDF you have to modify the standard docbook.xsl behavior either by using params or extending it. I am not sure how exactly but you can find info in http://sagehill.net/book-description.html
I've attached both. I ran:
xsltproc test.xsl 00_XBinder_Master.xml
I'm using Saxon with Oxygen for the transformation.
Best,
Ethan Metsger
------------------------------------------------------------------------
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Hello, If you want to modify the header or footer of a PDF output you need to customize the DocBook stylesheet for XSL-FO output. See the section about headers and footers in print customizations, that is XSL-FO customizations: http://www.sagehill.net/docbookxsl/PrintHeaders.html Regards, Sorin Mike Starov wrote:
And the like. I know that the rule is being triggered because I'm getting textual output in the resulting PDF. But so far I'm mystified about how to go about modifying the header with the product name and version. I am nearly certain the issue is namespace related, because I'm able to get xsltproc to transform the xml file using pretty trivial xsl. Now for PDF transformation your xsl is not correct. It is outputting HTML and you need FO. To get the correct footer in PDF you have to modify the standard docbook.xsl behavior either by using params or extending it. I am not sure how exactly but you can find info in http://sagehill.net/book-description.html

On Fri, 06 Feb 2009 03:13:16 -0500, Sorin Ristache <sorin@oxygenxml.com> wrote:
If you want to modify the header or footer of a PDF output you need to customize the DocBook stylesheet for XSL-FO output. See the section about headers and footers in print customizations, that is XSL-FO customizations:
Hi, Sorin, Mike. Thanks for your responses. I was able to get it working this morning using: <xsl:apply-templates select="//d:productname"/> instead. For whatever reason, attempting to use <xsl:value-of select="d:book/d:info/d:productname/> wasn't working. I had seen the page you directed me to before--in fact, it's in my bookmarks--but the missing namespace is what cost me there. So I was able to generate the documentation appropriately. Thanks for your kind and swift responses. Best, Ethan (emetsger@obj-sys.com)
participants (3)
-
Ethan Metsger
-
Mike Starov
-
Sorin Ristache