How can I produce A4 sized PDF output?
-
- Posts: 27
- Joined: Sat Jul 19, 2003 10:42 am
- Location: South Africa
- Contact:
In general you need to specify the page size by passing the paper.type parameter. In Oxy you can do this on the Transform Dialog > XSLT tab > Parameters. Add the parameter paper.type and set the value to A4.
The problem with this is that the parameter setting is only persistent for the XML Instance being transformed. In addition, since you most likely want to set many parameters, this method of definition is tedious.
Alternately you can modify the parameter in the DocBook XSL file, but this would mean that each time the XSL's increment a version, that you would have to redo all the changes.
The best option is to write yourself a customization layer and point to this for all your transformations.
For a more detailed discussion on the subject visit this Web Site.
http://www.sagehill.net/docbookxsl/index.html
See the part about print output options and about customization methods.
I recommend that you buy a copy of the PDF. Bob Stanton has done a really superb job with this book.
Enjoy,
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
My particular problem at the moment is doing exactly what you suggest in this topic: adding some (trivial) customisation. I have taken the example from http://www.sagehill.net/docbookxsl/index.html but whatever I do, it always results in me getting the message:
"E The process ended with code : 2 The error was : [ERROR] file:/C:/Temp/test.xml_fo:32:7 Root element must be root, not book"
Could you give a complete example that shows, say, how to change the paper size to A4?
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
It shouldn't be difficult especially with the predefined transformation scenarios in <oXygen/> that allow you to perform usual XSL transformations with just one mouse click. To transform a DocBook XML document to PDF just set the cursor in that XML document, press the toolbar button "Configure transformation scenario", in the displayed dialog select the scenario "DocBook PDF", press the Edit button, in the new displayed dialog press the "Parameters" button, then add a parameter with the name paper.type and the value A4 to the list of parameters, press OK in all three dialogs to close them. To apply the scenario you just configured now you just need one mouse click on the toolbar button "Apply transformation scenario".
I hope that helps,
Sorin
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
As I said, when I do this, I always get the error "Root element must be root, not book". What is causing the error?
I would really appreciate an example showing a trivial customisation layer,
as the example taken from the web site you referenced does not seem to work.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
The demo atPeterRobertson wrote:Could you give a complete example that shows, say, how to change the paper size to A4?
http://www.oxygenxml.com/demo/DocbookCu ... ation.html
demonstrates how to create in <oXygen/> a simple DocBook customization layer that sets the output paper type and page orientation and use this layer to transform a DocBook XML document to PDF.
Best regards,
Sorin
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
Here is my xml file:E The process ended with code : 2 The error was : [ERROR] file:/C:/Temp/Test.xml_fo:35:7 Root element must be root, not book
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN" "C:\Program Files\Oxygen 5.1\frameworks\docbook\dtd/docbookx.dtd" >
<book>
<bookinfo>
<title>My Book</title>
</bookinfo>
<part>
<title>Part1</title>
<chapter>
<title>Chapter 1</title>
<sect1><title>Section</title>
<para> This is my text </para>
</sect1>
</chapter>
</part>
</book>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="frameworks/docbooks/fo/docbook.xsl"/>
<xsl:param name="paper.type" select="A4landscape"/>
<xsl:param name="page.orientation" select="landscape"/>
</xsl:stylesheet>
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Configure a transformation that applies only your stylesheet to the input document and shows the output of the transformation. That output should be a FO document, that is it should start with fo:root element. From the error message it seems you are getting something else.
Best Regards,
George
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
configuring "a transformation that applies only..."
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Converting DocBook to PDF is a two steps process. First the DocBook XSL converts the XML to FO and then the FO is converted with a FOP to PDF. The error message says that in the first step you do not get a FO document.
Best Regards,
George
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
Code: Select all
<?xml version="1.0" encoding="utf-8"?><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="serif,Symbol,ZapfDingbats" font-size="10pt" text-align="justify" line-height="normal" font-selection-strategy="character-by-character" line-height-shift-adjustment="disregard-shifts" language="en">
<fo:layout-
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
One thing remains. If I use the following file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="frameworks\docbook\xsl\fo/docbook.xsl"/>
<xsl:param name="paper.type" select="A4"/>
</xsl:stylesheet>
and the output is NOT a4. Yet if I put the A4 setting as a parameter in the XSLT tab, I get the correct answer.W Making portrait pages on paper (8.5inx11in)
I have tried my example with several paper types (A3, A5, B4) and they all give the same message. I can actually put any string; it seems to be completely ignored. If I malform the xsl file I get an error, so I know it's being read.
If I remove the paper.type statement, I get the default of USletter,
and your example gives A4 landscape.
Any clues as to what's happening?
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="frameworks\docbook\xsl\fo/docbook.xsl"/>
<xsl:param name="paper.type" select="A4"/>
</xsl:stylesheet>
I have tried both variants "A4" and "'A4'"; it makes no difference. I can
put anything in place of A4 and the behaviour of the system never changes.
I have also verified that the xsl file is actually changing when I edit it.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Use this as customization layer for A4 portrait pages without setting a param in the XSLT tab of the scenario edit dialog. The value of the param paper.type must be enclosed by double quotes: " ' A4 ' ". I tried it and it works. If you put USletter or A5 it will work also.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="frameworks/docbook/xsl/fo/docbook.xsl"/>
<xsl:param name="paper.type" select="'A4'"></xsl:param>
</xsl:stylesheet>
Sorin
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
I have the following test file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN" "C:/Program Files/Oxygen 5.1/frameworks/docbook/dtd/docbookx.dtd" >
<book>
<bookinfo>
<title>My Book</title>
</bookinfo>
<part>
<title>Part1</title>
<chapter>
<title>Chapter 1</title>
<sect1><title>Section</title>
<para> This is my text </para>
</sect1>
</chapter>
</part>
</book>
Code: Select all
C:\Program Files\Oxygen 5.1\PaperSize.xsl
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="frameworks/docbook/xsl/fo/docbook.xsl"/>
<xsl:param name="paper.type" select="'A3'"></xsl:param>
</xsl:stylesheet>
I select my test xml file and go to "configure transformation scenario"
I make a copy of Docbook PFD and go to XSL URL, and use "Browse for a local input XSL file" to select PaperSize.xsl. The XSL URL box now contains:
Code: Select all
file:/C:/Program%20Files/Oxygen%205.1/PaperSize.xsl
Code: Select all
W Making portrait pages on A4 paper (210mmx297mm)
What has happened to my A3 selection?
As this works on your system, there must be something wrong in mine.
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Strangely I got the same behavior as you, while this worked ok on Sorin's machine... Then I remembered I set up the paper.type parameter in the scenario when I run a few tests a couple of days ago, I edited the scenario, removed the paper.type parameter and now everything is ok. Please make sure you do not have the same situation.
The need for apostrophes are not something related with XML but with XSLT. The select attribute value is treated similar with the value-of/@select so if you want to specify the element test you write
select="test"
but if you want to specify the constant value test you write
select=" 'test' "
Best Regards,
George
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
Thanks for all your help.
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service