[oXygen-user] importing a custom docbook epub stylesheet

Robert Nagle
Sat Jun 27 04:05:30 CDT 2009


Hi, I noticed there is a good web demo of how to customize a docbook
stylesheet.

http://www.oxygenxml.com/demo/DocbookCustomization/docbookCustomization.html

Basically you create a customization layer which imports the standard
docbook stylesheet. Then you edit that customization layer.

I noticed something strange. Oxygen validates the imported stylesheet
when XSLT version is 1.0, but if you change it to 2.0, I get 19
errors.

**********************
this is fine
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/epub/docbook.xsl"/>
</xsl:stylesheet>

******************
this produces saxon errors
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      exclude-result-prefixes="xs"
      version="2.0">
    <xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/epub/docbook.xsl"/>
</xsl:stylesheet>
***********************************
here's a screenshot of the error messages
http://www.flickr.com/photos/rjnagle/3664940578/

What it looks like is going on is that Oxygen is recognizing that the
XSL being imported is from docbook and therefore it uses a local copy
of the file. And it's seeing a mismatch between the latest version
online with the local xsl it is references.

So I changed it to this and got a smaller number of errors:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      exclude-result-prefixes="xs"
      version="2.0">
    <xsl:import
href="http://docbook.sourceforge.net/release/xsl/1.75.1/epub/docbook.xsl"/>
</xsl:stylesheet>

-- 
SystemID: I:\My Documents\xml\rj2\test99ertest\2rjcustom.xsl
Engine name: Saxon-B 9.1.0.6
Severity: error
Description: Failed to compile stylesheet. 1 error detected.

SystemID: http://docbook.sourceforge.net/release/xsl/1.75.1/epub/docbook.xsl
Engine name: Saxon-B 9.1.0.6
Severity: fatal
Description: The priority attribute must be absent if the match
attribute is absent
Start location: 1308:30
URL: http://www.w3.org/TR/xslt20/#err-XTSE0500

SystemID: http://docbook.sourceforge.net/release/xsl/1.75.1/common/stripns.xsl
Engine name: Saxon-B 9.1.0.6
Severity: warning
Description: The attribute axis starting at a document node will never
select anything
Start location: 282:0

I have some meta questions with regard to the general process of
debugging here.

1. I assume that xslt v2 is better because it's a bigger number (and
I've glanced over the differences in syntax, etc). Can you think of a
reason why something would fail when version 2 is specified which
would not be the case if version 1 is specified? Is best practice just
to play it safe and go with version 1, or should I generally use 2
unless otherwise specified?

2. I'm guessing that it's easier to debug a local copy of a xsl file
than a remote one (in this case version 1.7.5.1 of the epub-xsl
transform. which is different from the local version (which is 1.7.4
that came with 10.2).  Is there a way that Oxygen knows to associate
the URL in the xsl import command with a local file or files on my
Windows machine? I don't know how to do this.

3. (Now for my really naive question). What's the best way to debug
XSLT messages. Should I start at the source xsl of the file(s)  being
imported here. Or should I be looking up references in Saxon parser or
using some Oxygen debugging view.  I realize that the answer is
probably "it depends", but where does one start first?

Thanks.

Robert

3)

Robert Nagle
12777 Ashford Point Dr #1417
Houston, Texas 77082
713 893 3424
htpt://www.robertnagle.info



More information about the oXygen-user mailing list