
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