OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] changing from xsltproc to saxon


Regarding the -o option, it is for standard output from the process and not used in the chunking process, because that path is not passed to the XSLT process which is generating the filenames for chunks. The -o option will capture any output that is *not* explicitly written to a chunk file. In most cases, that is nothing, but there are some chunking configurations where some things are not chunked and they would go to standard output.

Bob Stayton
bobs@sagehill.net
On 3/29/2020 5:59 AM, Niels MÃller Larsen wrote:
Hi Bob

You have done it again! You once helped me with missing literature refs because of lack of ns in my downloaded xsl. Huge thanks.

Now it works as it did with xsltproc, a couple of small thing in the catalog, that I could fix.

I have a question about the -o option when chunking, and if it is connected to the base.dir param. Are both -o and base.dir necessary? it is not happy with a dir name in -o.

Starting to work at linenumbering I get:

 975 No numberLines function available.
 976 Processing terminated by xsl:message at line 309

relating to 

<programlisting language="_javascript_" linenumbering="numbered">const bcrypt = 
...

in my xml. In my customizations have:
...
    <xsl:param name="linenumbering.extension" select="1"/>
    <xsl:param name="local.l10n.xml" select="document('')"/>
    <xsl:param name="textinsert.extension">1</xsl:param>
    <xsl:param name="toc.max.depth">2</xsl:param>
    <xsl:param name="generate.toc">
        appendix  toc,title
        book      toc,title
        chapter   toc,title
        part      toc,title
        preface   toc,title
        reference toc,title
    </xsl:param>
    <xsl:param name="use.extensions" select="1"/>
...

which according to your book/site should make it work.

Cheers 
Niels


On Sat, 28 Mar 2020 20:04:49 -0700
Bob Stayton <bobs@sagehill.net> wrote:

Hi Niels,

I have found that the Java catalog resolver and xsltproc catalog 
resolver can have different behaviors. I can't remember the particulars 
but it had to do with the catalog being consulted even when the path 
exists as specified.

In this case, the problem is using the name "docbook.xsl", because that 
first resolves to your custom stylesheet, which imports chunk.xsl which 
in turn imports docbook.xsl, which triggers the catalog lookup again 
even though you don't intend it a second time.

Try changing your catalog and Makefile to use mydocbook.xsl instead.

Bob Stayton
bobs@sagehill.net

On 3/28/2020 5:29 PM, Niels MÃller Larsen wrote:
Hi again Bob

I changed the makefile to:

sax:
                 rm -rf site
                 mkdir site
                 cp css/* site
                 cp js/* site
                 xmllint --noent --xinclude \
                 module.xml > /tmp/docbresolved.xml \
                 2>./errloglint
                 java com.icl.saxon.StyleSheet \
                 -x org.apache.xml.resolver.tools.ResolvingXMLReader \
                 -y org.apache.xml.resolver.tools.ResolvingXMLReader \
                 -r org.apache.xml.resolver.tools.CatalogResolver \
                 -u \
                 -o site/index.html \
                 /tmp/docbresolved.xml \
                 docbook.xsl \
                 base.dir="site" \
                 use.extensions=1 \
                 2>./errlogxslt
                 tar czf site.tgz site/*
                 echo "site.tgz ready for deployment"

The catalog should then translate 'docbook.xsl' to

     <uri
         name="docbook.xsl"
         uri=".docbook/docbook.custom.xsl" />

The output from verbosity 4 is:

Parse catalog: file:/home/nml/.docbook/catalog.xml
Loading catalog: file:/home/nml/.docbook/catalog.xml
Default BASE: file:/home/nml/.docbook/catalog.xml
xml:base: file:///home/nml/
BASE STR: file:///home/nml/
rewriteSystem: http://www.oasis-open.org/docbook/xml/4.5/
	.docbook/
REWRITE_SYSTEM: http://www.oasis-open.org/docbook/xml/4.5/
	file:/home/nml/.docbook/
rewriteURI: http://docbook.sourceforge.net/release/xsl/current/
	xsl-stylesheets-1.79.2/
REWRITE_URI: http://docbook.sourceforge.net/release/xsl/current/
	file:/home/nml/xsl-stylesheets-1.79.2/
rewriteURI: file:///basics/
	.docbook/
REWRITE_URI: file:///basics/
	file:/home/nml/.docbook/
system: uvmat_entities.ent
	.docbook/uvmat_entities.ent
SYSTEM: uvmat_entities.ent
	file:/home/nml/.docbook/uvmat_entities.ent
uri: docbook.xsl
	.docbook/docbook.custom.xsl
URI: docbook.xsl
	file:/home/nml/.docbook/docbook.custom.xsl
uri: docbook.fo.xsl
	.docbook/docbook.custom.fo.xsl
URI: docbook.fo.xsl
	file:/home/nml/.docbook/docbook.custom.fo.xsl
uri: docbook.slides.xsl
	.docbook/docbook.custom.slides.xsl
URI: docbook.slides.xsl
	file:/home/nml/.docbook/docbook.custom.slides.xsl
uri: file:///foo/biblio.xml
	.docbook/biblio.xml
URI: file:///foo/biblio.xml
	file:/home/nml/.docbook/biblio.xml
(reset) xml:base: file:/home/nml/.docbook/catalog.xml
BASE STR: file:/home/nml/.docbook/catalog.xml
resolveURI(/tmp/docbresolved.xml)
resolveURI(/tmp/docbresolved.xml)
Resolved URI: /tmp/docbresolved.xml
	file:/tmp/docbresolved.xml
resolveURI(docbook.xsl)
Resolved URI: docbook.xsl
	file:/home/nml/.docbook/docbook.custom.xsl
resolveSystem(file:/home/nml/.docbook/docbook.custom.xsl)
resolveSystem(file:/home/nml/docbook/uvmat_entities.ent)
resolveSystem(file:/home/nml/docbook/xhtml-lat1.ent)
resolveSystem(file:/home/nml/docbook/xhtml-symbol.ent)
resolveSystem(file:/home/nml/docbook/xhtml-special.ent)
resolveSystem(file:/home/nml/docbook/hsizes.ent)
resolveURI(/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml5/chunk.xsl)
Resolved URI: /usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml5/chunk.xsl
	file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml5/chunk.xsl
resolveSystem(file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml5/chunk.xsl)
resolveURI(docbook.xsl)
Resolved URI: docbook.xsl
	file:/home/nml/.docbook/docbook.custom.xsl
resolveURI(/home/nml/docbook/docbook.common.custom.xsl)
Resolved URI: /home/nml/docbook/docbook.common.custom.xsl
	file:/home/nml/docbook/docbook.common.custom.xsl
resolveSystem(file:/home/nml/docbook/docbook.common.custom.xsl)
resolveSystem(file:/home/nml/docbook/uvmat_entities.ent)
resolveSystem(file:/home/nml/docbook/xhtml-lat1.ent)
resolveSystem(file:/home/nml/docbook/xhtml-symbol.ent)
resolveSystem(file:/home/nml/docbook/xhtml-special.ent)
resolveSystem(file:/home/nml/docbook/hsizes.ent)
make: *** [Makefile:23: sax] Error 2

which as far as I can see is correct

the error message is now:

Error at xsl:import on line 15 of file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml5/chunk.xsl:
   A stylesheet cannot import itself
Transformation failed: Failed to compile stylesheet. 1 error detected.

This puzzles me because I use the same stylesheet when I run with xsltproc without problems.

The installation has:
nmlX240 TheModelChapter  $ ls /usr/share/xml/docbook
docbook-xsl-1.79.2  xml-dtd-4.2  xml-dtd-4.4  xsl-stylesheets-1.79.2
xml-dtd-4.1.2       xml-dtd-4.3  xml-dtd-4.5  xsl-stylesheets-1.79.2-nons


Cheers
/Niels

On Sat, 28 Mar 2020 14:37:22 -0700
Bob Stayton <bobs@sagehill.net> wrote:

I think what is happening is your XSL URL is directly calling the
chunk.xsl file, which import docbook.xsl, which is getting mapped by the
catalog file to use:

<uri
  ÂÂÂÂÂÂÂ name="docbook.xsl"
  ÂÂÂÂÂÂÂ uri=".docbook/docbook.custom.xsl" />

which then reimports the DocBook stylesheet file. Try setting
verbosity=4 in your CatalogManager.properties file and watch how the
catalog is being used.

Bob Stayton
bobs@sagehill.net

On 3/28/2020 11:40 AM, Niels MÃller Larsen wrote:
Thanks for speedy reply.

My catalog looks as follows:


<?xml version="1.0"?>
<!DOCTYPE catalog
     PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
     "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">

    <!-- DTD and stylesheet files installed under /usr/share/xml -->
    <group  xml:base="file:///home/nml/">

      <!-- Resolve DTD URL system ID to local file -->
      <rewriteSystem
          systemIdStartString="http://www.oasis-open.org/docbook/xml/4.5/"
          rewritePrefix=".docbook/" />
      <!-- Resolve stylesheet URL to local file -->
      <rewriteURI
          uriStartString="http://docbook.sourceforge.net/release/xsl/current/"
          rewritePrefix='xsl-stylesheets-1.79.2/' />
      <rewriteURI
          uriStartString="file:///basics/"
          rewritePrefix=".docbook/" />

      <!-- To resolve simple DTD SYSTEM identifiers. -->
      <!-- Note: this does not work with Java resolver -->
      <!--   classes in Saxon or Xalan -->

      <system
           systemId="uvmat_entities.ent"
           uri=".docbook/uvmat_entities.ent" />
      <!-- To resolve short stylesheet references -->
      <uri
          name="docbook.xsl"
          uri=".docbook/docbook.custom.xsl" />
      <uri
          name="docbook.fo.xsl"
          uri=".docbook/docbook.custom.fo.xsl" />
      <uri
          name="docbook.slides.xsl"
          uri=".docbook/docbook.custom.slides.xsl" />
      <uri
          name="file:///foo/biblio.xml"
          uri=".docbook/biblio.xml"/>
    </group>

</catalog>


And my docbook.custom.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE stylesheet [
<!ENTITY % uvmatent SYSTEM "/home/nml/docbook/uvmat_entities.ent">
%uvmatent;
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                            xmlns="http://www.w3.org/1999/xhtml"
                            version="1.0">
<!--
      Customization xsl stylesheet for docbook to chunked html transform
-->

<!-- import base stylesheet -->
<!--  <xsl:import href=""/> -->
<!--  <xsl:import href=""/> -->
      <xsl:import href=""/>

<!-- customization vars -->
      <xsl:import href=""/>
</xsl:stylesheet>

The docbook.common.custom.xsl just holds a series of parameters

/Niels



On Sat, 28 Mar 2020 11:29:22 -0700
Bob Stayton <bobs@sagehill.net> wrote:

I think the first error message is the most informative. This file:

/home/nml/.docbook/docbook.custom.xsl

is not part of the DocBook XSL distribution, and it does not seem to be
mentioned in your Makefile. Have you examined that file to see what it is?

I suspect the catalog resolver is mapping the stylesheet URL to that file.

Bob Stayton
bobs@sagehill.net

On 3/28/2020 11:14 AM, Niels MÃller Larsen wrote:
When producing html output from my docbook I use the following fragment of a Makefile:

html:
                   rm -rf site
                   mkdir site
                   cp css/* site
                   cp js/* site
                   xmllint --noent --xinclude \
                                   module.xml > /tmp/docbresolved.xml \
                                   2>./errloglint
                   xsltproc \
                                   --output site/ \
                                   docbook.xsl \
                                   /tmp/docbresolved.xml \
                                   2>./errlogxslt && \
                   tar czf site.tgz site/*
                   echo "site.tgz ready for deployment"

This works, and it has worked for a long time. I write about coding, so I have some need to change to using saxon for added functionality with respect to linenumbering and code highlighting. The first step would be a 1:1 change, and I have tried:

html:
           rm -rf site
           mkdir site
           cp css/* site
           cp js/* site
           xmllint --noent --xinclude \
                   module.xml > /tmp/docbresolved.xml \
                   2>./errloglint
           java com.icl.saxon.StyleSheet \
                   -x org.apache.xml.resolver.tools.ResolvingXMLReader \
                   -y org.apache.xml.resolver.tools.ResolvingXMLReader \
                   -r org.apache.xml.resolver.tools.CatalogResolver \
                   -u \
                   -o site/index.xhtml \
                   /tmp/docbresolved.xml \
                   /usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml5/chunk.xsl \
                   base.dir="site" \
                   use.extensions=1 \
                   2>./errlogxslt
           tar czf site.tgz site/*
           echo "site.tgz ready for deployment"

This gives me errors:

Error at xsl:import on line 16 of file:/home/nml/.docbook/docbook.custom.xsl:
     A stylesheet cannot import itself
Error at xsl:when on line 25 of file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml/chunk-common.xsl:
     Variable exsl.node.set.available has not been declared
Error at xsl:if on line 26 of file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml/chunk-common.xsl:
     Variable chunk.quietly has not been declared
Error at xsl:apply-templates on line 29 of file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml/chunk-common.xsl:
     Variable with.namespace has not been declared
Error at xsl:when on line 31 of file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml/chunk-common.xsl:
     Variable exsl.node.set.available has not been declared
Error at xsl:if on line 32 of file:/usr/share/xml/docbook/xsl-stylesheets-1.79.2/xhtml/chunk-common.
......

I have tried many variations and several stylesheets, this just changes the error messages I get.

Does anyone have an example of a workflow that works? Chunked output is a must.



        



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]