Re: [docbook-apps] Using ePub
Hi, On Wed, Mar 25, 2009 at 4:03 PM, Eric Johnson emjoh...@progress.com wrote: I’m interested in generating ePub books from my DocBook 5.0 source and was wondering what steps I need to take. I tried just running the XML through the ePub stylesheet and zipping up the results which mostly works. The resulting book opens in Stanza for iPhone, but not Stanza desktop. The desktop version generates a namespace error. The book also fails the on-line ePub validator. Is there some customization I need to do? Do I need to also run the Ruby stuff to package the book correctly? You do need to use some other program to invoke the stylesheets. The README in epub/README (https://docbook.svn.sourceforge.net/svnroot/docbook/trunk/xsl/epub/README) describes how to use the included Ruby command: $ dbtoepub --help Usage: dbtoepub [OPTIONS] [DocBook Files] dbtoepub converts DocBook book and articles into to .epub files. .epub is defined by the IDPF at www.idpf.org and is made up of 3 standards: - Open Publication Structure (OPS) - Open Packaging Format (OPF) - Open Container Format (OCF) Specific options: -d, --debug Show debugging output. -h, --help Display usage info -v, --verboseMake output verbose You may also be interested in other tools for invoking the stylesheets, like Liza Daly's Python program docbook2epub: http://code.google.com/p/epub-tools/ Keith - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Always proportionally scale imagedata to page.
On Mar 26, 2009, at 01:46, Bob Stayton wrote: Hi David, I think I understand what you want, but I need one clarification. This combination: scalefit=1 width=100% contentdepth=100% does not have the effect that you want. snip/ I think you intended: scalefit=1 width=100% depth=100% This sets the viewport to the maximum available size, and scales up the image until it bumps into one of the edges of the viewport. Cool, thanks. But I'm not clear what you mean by the largest size on the page. Does that mean for an image which is taller than it is wide, that it should scale to fit the remaining vertical space on the page (which might be quite small)? Hmmm. I hadn't considered this, but that would be useful in a number of cases. Or perhaps the largest size on a new page (which may require a forced page break to get the largest vertical space available)? I think what you provided earlier is what I'm after. Basically, max viewport, scale proportionally until the image meets an edge. Regarding the customization process, you pretty much have to customize the process.image template. This requires understanding the sequence of how the DocBook scaling attributes are massaged into the FO scaling attributes. Some attributes take precedence over others, so they interact a bit and it gets a little complicated. So I saw when perusing process.image. Being able to specify default values for some of the attributes would be a nice feature request. Good idea done. 2714716. If you can add a preprocessing XSLT step, you could process with an identity stylesheet that just adds the attributes you want to imagedata (with logic to add them only if no overrides present). Then you don't have to mess with process.image. Thanks for the advice. I may look at this after I get my current doc done -- it's a business plan for a loan, so I want to finish it as rapidly as possible. ;) -David - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] how to omit blank pages in the front matter?
Hi, The good news is that you do not need to do custom page masters to control this. Each page-sequence determines its own starting page number and whether it generates a blank page at the end to force an even number of pages (for double sided output). The preface, toc, and each of the List Of are in their own page sequence, and in double.sided output that means they end on an even page which forces those blank pages if necessary. In DocBook XSL, there are two templates that customize this behavior, and you have to do both because in XSL-FO page numbers do not always have to be sequential. The template named 'force.page.count' in fo/pagesetup.xsl is used to specify the attribute value for the force-page-count property. It is called for each page-sequence. When that property is 'end-on-even' it forces a blank page if necessary. If it is 'no-force', then no blank page. You want to set your front matter page-sequences to use 'no-force'. The template named 'initial.page.number' is used to specify the attribute value for the initial-page-number property on each page sequence. When set to 'auto-odd', it starts the page-sequence on the next odd number. If set to 'auto', then it starts on the next available page number (even or odd). The default value for double.sided output is 'auto-odd', so if you don't change this template too, you will find that you are skipping page numbers in your output because the blank page is not generated but 'auto-odd' is still on. Both templates are fed two params: the name of the page master and the element for which the page-sequence is being generated. The TOC and List Of page sequences use page master name 'lot', and preface and other front matter use 'front'. You use those in an xsl:choose to customize behavior. This customization does what you want, I think. I left force-page-count=end-on-even for preface so whatever comes after it (like a chapter) will start on an odd page, assuming you are using double-sided output. I use 'starts-with' in the test for the $master-reference value so it works with both 'front' and 'front-draft' page masters. xsl:template name=force.page.count xsl:param name=element select=local-name(.)/ xsl:param name=master-reference select=''/ xsl:choose xsl:when test=starts-with($master-reference, 'lot')no-force/xsl:when xsl:when test=$element = 'preface'end-on-even/xsl:when xsl:when test=starts-with($master-reference, 'front')no-force/xsl:when !-- double-sided output -- xsl:when test=$double.sided != 0end-on-even/xsl:when !-- single-sided output -- xsl:otherwiseno-force/xsl:otherwise /xsl:choose /xsl:template xsl:template name=initial.page.number xsl:param name=element select=local-name(.)/ xsl:param name=master-reference select=''/ !-- Select the first content that the stylesheet places after the TOC -- xsl:variable name=first.book.content select=ancestor::book/*[ not(self::title or self::subtitle or self::titleabbrev or self::bookinfo or self::info or self::dedication or self::preface or self::toc or self::lot)][1]/ xsl:choose !-- double-sided output -- xsl:when test=$double.sided != 0 xsl:choose xsl:when test=starts-with($master-reference, 'lot')auto/xsl:when xsl:when test=starts-with($master-reference, 'front')auto/xsl:when xsl:when test=$element = 'preface'auto/xsl:when xsl:when test=$element = 'toc'auto/xsl:when xsl:when test=$element = 'book'1/xsl:when !-- preface typically continues TOC roman numerals -- !-- Change page.number.format if not -- xsl:when test=$element = 'preface'auto-odd/xsl:when xsl:when test=($element = 'dedication' or $element = 'article') and not(preceding::chapter or preceding::preface or preceding::appendix or preceding::article or preceding::dedication or parent::part or parent::reference)1/xsl:when xsl:when test=generate-id($first.book.content) = generate-id(.)1/xsl:when xsl:otherwiseauto-odd/xsl:otherwise /xsl:choose /xsl:when !-- single-sided output -- xsl:otherwise xsl:choose xsl:when test=$element = 'toc'auto/xsl:when xsl:when test=$element = 'book'1/xsl:when xsl:when test=$element = 'preface'auto/xsl:when xsl:when test=($element = 'dedication' or $element = 'article') and not(preceding::chapter or preceding::preface or preceding::appendix
Re: [docbook-apps] Using ePub
Indeed, the xmlns errors indicate a problem in the stylesheet. You can't assign an element to a namespace by trying to assign an ordinary attribute with name xmlns. It must use the namespace attribute on xsl:element. Change this (and the like): xsl:element name=item xsl:attribute name=xmlnshttp://www.idpf.org/2007/opf/xsl:attribute to this: xsl:element name=item namespace=http://www.idpf.org/2007/opf; Bob Stayton Sagehill Enterprises b...@sagehill.net - Original Message - From: Eric Johnson emjoh...@progress.com To: Keith Fahlgren abdela...@gmail.com Cc: docbook-apps@lists.oasis-open.org Sent: Thursday, March 26, 2009 3:10 PM Subject: RE: [docbook-apps] Using ePub Our system uses Ant and Saxon so the ruby script isn't really going to work. I tried building up an Ant target to do the packaging: target name=docbook.epub description=Builds Epub output java classname=com.icl.saxon.StyleSheet classpathref=xslt-classpath fork=true dir=. maxmemory=512M sysproperty key=javax.xml.parsers.DocumentBuilderFactory value=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl / sysproperty key=javax.xml.parsers.SAXParserFactory value=org.apache.xerces.jaxp.SAXParserFactoryImpl / sysproperty key=org.apache.xerces.xni.parser.XMLParserConfiguration value=org.apache.xerces.parsers.XIncludeParserConfiguration / arg value=-x / arg value=org.apache.xml.resolver.tools.ResolvingXMLReader / arg value=-y / arg value=org.apache.xml.resolver.tools.ResolvingXMLReader / arg value=-r / arg value=org.apache.xml.resolver.tools.CatalogResolver / arg value=${docbook.in} / arg value=${env.DBCK_HOME}/lib/docbook-xsl-ns/epub/docbook.xsl / arg value=target.database.document=${HTMLSITEMAP} / arg value=current.docid=${docbook.docid} / /java copy todir=OEBPS/imagesdb fileset dir=${env.DBCK_HOME}/custom-ns/imagesdb / /copy copy todir=OEBPS/images failonerror=false fileset dir=images / /copy delete file=output/${docbook.epub} failonerror=false / echo file=mimetypeapplication/epub+zip/echo zip destfile=output/${docbook.epub} whenempty=skip fileset dir=. includes=mimetype/ zipfileset dir=OEBPS prefix=OEBPS / zipfileset dir=META-INF prefix=META-INF / /zip delete failonerror=false includeemptydirs=true fileset dir=. includes=mimetype/ fileset dir=OEBPS / fileset dir=META-INF / /delete /target The problem I'm still running into is that the I get the following string of errors: [java] Recoverable error [java] at xsl:attribute on line 380 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java] Invalid attribute name: xmlns [java] Recoverable error [java] at xsl:attribute on line 559 of file:/c:/dcbk/lib/docbook-xsl-ns/epub/docbook.xsl: [java]
Re: [docbook-apps] Titlepages under HTML with multiple mediaobjects
Hi Dean, The titlepage spec mechanism supports a t:predicate attribute on elements in the titlepage specs. The predicate lets you use xpath syntax to select graphics. For example: t:titlepage-content t:side=recto mediaobject t:predicate=[...@role = 'logo']/ title t:named-template=division.title param:node=ancestor-or-self::book[1] text-align=center font-size=hsize5; space-before=hsize5space; font-weight=bold font-family={$title.fontset}/ mediaobject t:predicate=[not(@role) or @role != 'logo']/ Now just add a role=logo to the logo mediaobject, and it will appear before the title. All other mediaobjects will appear after the title. Bob Stayton Sagehill Enterprises b...@sagehill.net - Original Message - From: deannel...@aol.com To: docbook-apps@lists.oasis-open.org Sent: Thursday, March 26, 2009 3:49 PM Subject: [docbook-apps] Titlepages under HTML with multiple mediaobjects All, I am a bit stumped. I have two images in a bookinfo. One is used for the company logo and the other is the product image. I would like to have both of these on the titlepage in the following order Logo Title Product Image Since I am producing PDF and HTML, I am using mediaobjects. Under the current stylesheets, it places the images before the Title: Logo Product Image Title The question is: How do I change the order? It looks like titlepage template processing gets all of the mediaobjects and clumps them together. Any ideas? Dean Nelson -- Great Deals on Dell 15 Laptops - Starting at $479
[docbook-apps] Strange table behavior
All, This is really not a Docbook issue, but rather an HTML issue, but it seems like someone here may know the reason for this. I have a table in Docbook where I left align the cell. Pretty straight forward, but when I output HTML it looks like justified text and not what I would expect. This isn't what I would call left justified. Am I missing something here or is this just the way it is? But the HTML that is produced shows left align. td align=leftpDocBook: The Definitive Guide/p/td This isn't what I would call left justified. Am I missing something here or is this just the way it is? Thanks Dean Nelson **Great Deals on Dell 15 Laptops - Starting at $479 (http://pr.atwola.com/promoclk/100126575x1219799606x1201361003/aol?redir=http:%2F%2Fad.doub leclick.net%2Fclk%3B213153745%3B34689725%3Bo) inline: Untitled.jpg- To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
Re: [docbook-apps] Using ePub
On Thu, Mar 26, 2009 at 3:39 PM, Bob Stayton b...@sagehill.net wrote: Indeed, the xmlns errors indicate a problem in the stylesheet. You can't assign an element to a namespace by trying to assign an ordinary attribute with name xmlns. It must use the namespace attribute on xsl:element. Change this (and the like): xsl:element name=item xsl:attribute name=xmlnshttp://www.idpf.org/2007/opf/xsl:attribute to this: xsl:element name=item namespace=http://www.idpf.org/2007/opf; Thanks for this bug report, Bob. I'm surprised xsltproc never cared but the code was horribly casual with namespaces, and this has been resolved in SVN. Eric: You can either grab a new epub/docbook.xsl here http://docbook.svn.sourceforge.net/svnroot/docbook/trunk/xsl/epub/docbook.xsl or wait for one of the snapshot builds. Please let me know what I can do to help you get Ant going. I'm not an Ant user, but have a basic understanding of the three ePub specs. You may find this list of resources useful: http://labs.oreilly.com/2009/03/epub-resources-and-guides.html Keith - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
[docbook-apps] ePub with Chinese character
After I create epub book, FBReader works fine, Adobe Digital Editions can't display Chinese character, only show ''. Is there any advice for Chinese eBook ? --- Dongsheng Song - To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org