Re: [docbook-apps] beta EPUB3 stylesheet available

From
Bob Stayton <>
Date
2011-09-19T21:52:18+00:00
ID
01ce01cc7716$595b8e20$6600a8c0@pazu
Thread
Re: [docbook-apps] beta EPUB3 stylesheet available
Hi Lars,

That entity is actually used by the automatic 
indexing templates.  I had originally placed it in docbook.xsl because I 
had custom indexing templates in there, but I moved those templates to 
xhtml-element-mods.xsl (which also has that entity, BTW).  It is no longer 
needed in docbook.xsl, and will be removed from the next beta.  I'm glad it 
worked, but I'm mystified why it did not work before.

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  Lars Vogel 

  
To: Bob Stayton 

  
Cc: DocBook Apps 

  
Sent: Monday, September 19, 2011 2:47 
  PM

  
Subject: Re: [docbook-apps] beta EPUB3 
  stylesheet available

  

Hi Bob,
  

  
If I remove 

  

  

  
<!DOCTYPE xsl:stylesheet [

  
<!ENTITY % common.entities SYSTEM "../common/entities.ent">

  
%common.entities;

  
]>

  

  
from the xhtml5/docbook.xsl the conversion works fine without 
  xerces-j. 

  

  
I have no idea what the above entry is used for ;-) so I have no idea if 
  that is a solution or creating a problem elsewhere.

  

  
Best regards, Lars

  

  
2011/9/19 Lars Vogel <>

  Hi Bob,
    

    
The xhmlt5 Stylesheets work fine under Windows7 (without the xerces-j 
    parser for me). 

    

    
Best regards, Lars
    

    

    

    

    
2011/9/19 Lars Vogel <>

    Hi Bob,
      

      
I was testing under Linux with Ubuntu 10.04, just in case you have 
      easy access to a Linux box this might help you to reproduce the 
      error. 

      

      
I will also re-build the example on Windows7 and let you know if it 
      works or not. 

      

      
Best regards, Lars

      

      

      

      

      

      
2011/9/19 Bob Stayton <>

      
        

        
Hi Lars,

        
This is strange.  While I always use 
        the Xerces-J parser with Saxon 6, I did not mean to introduce a new 
        dependency on it.  I just ran it again with Xerces turned off and 
        its jar file excluded from the classpath, and the xhtml5/docbook.xsl and 
        chunk.xsl work fine without it.  I'm running java version 
        "1.6.0_05" on Windows XP under Cygwin.  So I'm not able to 
        reproduce your error yet.  My command looks like this:

        
 

        
java -cp saxon.jar com.icl.saxon.StyleSheet 
        -o mybook.html mybook.xml 
        ../docbook-xsl-1.76.1/xhtml5/docbook.xsl

        
 

        
You say the html and xhtml stylesheets work 
        without xerces-j, but I don't think the xhtml5 stylesheets are doing 
        anything fundamentally different from those stylesheets.   
        They all pull in stylesheet files from other directories using relative 
        paths.  For example, the html/autoidx.xsl file has the same 
        relative path entity declaration:

        
 

        
<!ENTITY % common.entities SYSTEM 
        "../common/entities.ent">
%common.entities;

        
 

        
Also, the html/docbook.xsl file imports 
        templates using relative pathnames:

        
 

        
<xsl:include 
        href=""/>

        

        
I wonder why it works in those instances 
        but not in the xhtml5 instance? I wonder if that error message is being 
        helpful in identifying the source of the problem.

        

        
 

        
Bob Stayton
Sagehill Enterprises


        
 

        
 

        
          

          
----- Original Message ----- 

          
From: Lars Vogel 
          

          
To: Bob Stayton 

          
Cc: DocBook 
          Apps 

          

          

          

          
Sent: Sunday, September 18, 2011 
          2:42 PM

          
Subject: Re: [docbook-apps] beta 
          EPUB3 stylesheet available

          

Hi Bob,

thanks for the reply. I believe I found 
          the issue. I wasn't using xerces-j but the standard Java libraries. 
          

I tried with html, xhtml and xhtml1-1 and they seem to be 
          working fine without xerces-j . With xerces-j the convertion works 
          fine with and without Ant.

Is the usage of xerces-j intended? 
          I'm not familiar with the differences of xerces-j and the standard 
          Java ones but it seems that the existing libraries work fine without 
          xerces-j.

Best regards, Lars

          
2011/9/18 Bob Stayton <>

          
            

            
Hi Lars,

            
I have not tried it with Saxon 9, but 
            since saxon 9 lacks the exsl:node-set() function, then the 
            stylesheet will need to be changed to work with Saxon 9.  
            

            
 

            
The error with Saxon 6 is odd, 
            because that is what I used when testing it.  The error 
            message:

            

            
 

            
java.net.MalformedURLException: no protocol: 
            ../common/entities.ent

            
seems to be saying that relative URLs 
            starting with "../" are malformed because they lack a protocol part, 
            but that is always true for relative URLs.  And the other 
            stylesheets use that syntax in several modules.  I don't 
            understand why you are getting that error.  Can you run Saxon 
            outside of Ant and reproduce the same error?

            
 

            
That entity declaration for 
            ../common/entities.ent at the top of the docbook.xsl file is no 
            longer needed.  I moved the templates that used those entities 
            (indexing templates) to the html5-element-mods.xsl file, so the 
            entity declaration is needed there.  If you remove it from the 
            docbook.xsl file, does it still fail when it is encountered in 
            html5-element-mods.xsl?

            

            
 

            
Bob Stayton
Sagehill Enterprises


            
 

            
 

            
              

              
----- Original Message ----- 

              
From: 
              Lars 
              Vogel 

              
To: Bob Stayton 

              
Cc: DocBook Apps 

              
Sent: Saturday, September 17, 
              2011 2:12 PM

              
Subject: Re: [docbook-apps] 
              beta EPUB3 stylesheet available

              

              

              

              
Hi Bob,

these are great news, thank you. I tried using 
              the xhtml5 stylesheets.

Unfortunately I receive an error 
              message. I tried with Saxon9 and Saxon6.5.5

Here is the 
              error message for Saxon9:

     [xslt] 
              /home/vogella/workspace/docu/de.vogella.docbook/docbook-xsl-1.76.1/xhtml5/html5-element-mods.xsl:456: 
              Fatal Error! Cannot find a matching 1-argument function named {http://exslt.org/common}node-set(). There is no 
              Saxon extension function with the local name 
              node-set

Here is the error message for 
              Saxon6.5.5

   [xslt] Loading stylesheet 
              /home/vogella/workspace/docu/de.vogella.docbook/docbook-xsl-1.76.1/xhtml5/docbook.xsl
     
              [xslt] Failed to process null

BUILD 
              FAILED
/home/vogella/workspace/docu/de.vogella.docs/buildhtml5.xml:535: 
              javax.xml.transform.TransformerConfigurationException: 
              java.net.MalformedURLException: no protocol: 
              ../common/entities.ent

Here is the Apache Ant file which 
              I'm using for the transformation:

    
              <target name="build-html5" depends="xinclude" 
              description="Generates HTML5 files from DocBook 
              XML">
        <xslt 
              style="${myhtml.stylesheet}" extension=".html" 
              basedir="${output.tmp}" 
              destdir="${article.dir}">
    
                      <include 
              name="**/*article.xml" />
    
                      <param 
              name="html.stylesheet" _expression_="${stylesheet}" 
              />
            
              <param name="section.autolabel" _expression_="1" 
              />
            
              <param name="make.valid.html" _expression_="1" 
              />
            
              <param name="html.cleanup" _expression_="1" 
              />
            
              <param name="chunker.output.encoding" _expression_="UTF-8" 
              />
            
              <outputproperty name="indent" value="yes" 
              />
            
              <classpath refid="saxon.class.path" />
    
                  </xslt>

    
                  <!-- Copy the stylesheet to the top level 
              directory-->
        <copy 
              todir="${article.dir}/..">
    
                      <fileset 
              dir="lib">
        
                      <include 
              name="styles.css" />
        
                  </fileset>
    
                  </copy>
    
              </target>

The same conversion works fine using the 
              existing html or xhtml stylesheets. 

Best regards, 
              Lars

              
2011/9/17 Bob Stayton <>

              I've got the DocBook XSL stylesheet for 
                generating HTML5 output and EPUB3 books working, at least to 
                beta level.  If you are interested in trying it out, you 
                can download the files from the DocBook SourceForge Files area, 
                under the EPUB3 folder

https://sourceforge.net/projects/docbook/files/epub3/

It 
                currently consists of two directories that are added to an 
                existing docbook-xsl-1.76.1 installation, adding "xhtml5" and 
                "epub3" directories.  They are actually customizations of 
                the xhtml stylesheets, and contain relative path references to 
                those files, so they should be installed in parallel with the 
                xhtml directory.  At some point I will incorporate them 
                into the normal build so they can appear in a regular 
                docbook-xsl-snapshot.

Each directory includes a README 
                file to give you more information about how to use the 
                stylesheets and test your output.  Feedback is 
                welcome.

The stylesheets include support for some of the 
                new EPUB features, such as video, audio, and MathML. 
                 However, not all EPUB browsers are up to handling them. 
                 See the README for details.

Bob Stayton
Sagehill 
                Enterprises


---------------------------------------------------------------------
To 
                unsubscribe, e-mail: 
For 
                additional commands, e-mail: 

-- 
Lars
http://www.vogella.de - Eclipse, Android and 
              Java Tutorials
http://www.twitter.com/vogella - Lars on 
              Twitter

-- 
Lars
http://www.vogella.de - Eclipse, Android and Java 
          Tutorials
http://www.twitter.com/vogella - Lars on 
          Twitter

      

-- 
Lars
http://www.vogella.de - Eclipse, Android and Java 
      Tutorials
http://www.twitter.com/vogella - Lars on 
      Twitter

    

-- 
Lars
http://www.vogella.de - Eclipse, Android and Java 
    Tutorials
http://www.twitter.com/vogella - Lars on 
    Twitter

  

-- 
Lars
http://www.vogella.de - Eclipse, Android and Java 
  Tutorials
http://www.twitter.com/vogella - Lars on 
  Twitter