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] xml catalogs xerces, saxon, and olinking (target database is picked up as relative to docbook-xsl)


Hi Chris,
Yes, it is possible to write out the db4 document generated from a db5 
input file.  Here is a stylesheet that I use for debugging the stripNS mode 
used for DocBook 5 processing.  It copies out the namespace-free nodeset 
instead of processing it further.  I've never used the output for further 
processing, so let me know how that works.  8^)

One thing you will find if you use Saxon 6 is that Norm wrote the template 
named in "add-xml-base" in common/stripns.xsl that adds an xml:base 
attribute to the root element of the DB4 nodeset.  It uses a Saxon 
extension function saxon:systemId to get the URI of the file being 
processed.   Then the question is why doesn't that xml:base provide the 
processor with the information it needs to find the olink database? I don't 
know yet.

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:exsl="http://exslt.org/common";
                xmlns:ng="http://docbook.org/docbook-ng";
                xmlns:db="http://docbook.org/ns/docbook";
                exclude-result-prefixes="db ng exsl"
                version='1.0'>

<xsl:import href="../docbook-xsl-1.71.0/fo/docbook.xsl"/>

<xsl:template match="/">
  <xsl:if test="function-available('exsl:node-set')
               and (*/self::ng:* or */self::db:*)">
    <xsl:variable name="nons">
      <xsl:apply-templates mode="stripNS"/>
    </xsl:variable>
    <xsl:copy-of select="exsl:node-set($nons)"/>
  </xsl:if>
</xsl:template>

</xsl:stylesheet>


Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Chris Chiasson" <chris@chiasson.name>
To: "Jirka Kosek" <jirka@kosek.cz>
Cc: "DocBook Apps" <docbook-apps@lists.oasis-open.org>
Sent: Monday, September 18, 2006 7:48 PM
Subject: Re: [docbook-apps] xml catalogs xerces, saxon, and olinking 
(target database is picked up as relative to docbook-xsl)


> Well, I used ant to feed a fully qualified path to saxon, but it is
> still failing. I have included the saxon output with the catalog
> manager debug level at 99 along with the content of teh olinkdb.xml
> (yes, i switched to using the default name for this file).
>
> Is it possible to have the stylesheets write the "db4" document (as
> converted from my db5 src) out to a file so that I can restart the
> transformation? It seems like this would make xsltproc and saxon work
> a little better and give you stylesheet authors more time work on
> other things.
>
> Here is an echo of the parameters I passed on the "command line" (this
> is right, right?)
>
>     [echo] 
> target.database.document=file:///C:/workspace/build/Engineering_Optimization/olinkdb.xml
>     [echo] 
> target.filename=file:///C:/workspace/build/Engineering_Optimization/target.db
>
> Saxon output clip:
>
>     [java] Stripping NS from DocBook 5/NG document.
>     [java] Processing stripped document.
>     [java] Writing target.db for book(Engineering_Optimization)
>     [java] 
> resolveURI(file:///C:/workspace/build/Engineering_Optimization/olink
> db.xml)
>     [java] Resolved URI: 
> file:///C:/workspace/build/Engineering_Optimization/ol
> inkdb.xml
>     [java] 
> file:/C:/workspace/build/Engineering_Optimization/olinkdb.xml
>     [java] 
> resolveSystem(file:/C:/workspace/build/Engineering_Optimization/targ
> et.db)
>     [java] resolveSystem(http://www.w3.org/TR/html4/loose.dtd)
>     [java] resolvePublic(-//W3C//DTD HTML 4.01 
> Transitional//EN,http://www.w3.o
> rg/TR/html4/loose.dtd)
>     [java] Error on line 31 column 3 of 
> http://www.w3.org/TR/html4/loose.dtd:
>     [java]   Error reported by XML parser: The declaration for the entity 
> "HTML
> .Version" must end with '>'.
>     [java] Error on line 8 column 24 of 
> file:/C:/workspace/build/Engineering_Op
> timization/olinkdb.xml:
>     [java]   Error reported by XML parser: Error attempting to parse XML 
> file (
> href='target.db').
>     [java] resolveURI()
>     [java] Recoverable error
>     [java] Resolved URI:
>     [java] org.xml.sax.SAXParseException: Error attempting to parse XML 
> file (h
> ref='target.db').
>     [java] 
> file:/C:/Program%20Files/docbook-xsl/docbook-xsl-1.71.0/html/pro
> file-docbook.xsl
>     [java] Olink error: could not open target database 
> 'file:///C:/workspace/bu
> ild/Engineering_Optimization/olinkdb.xml'.
>     [java] Error: unresolved olink: targetdoc/targetptr = 
> 'self/HW1_Appendix'.
>
> olinkdb.xml (in the same dir as the xml files)
>
> <?xml version="1.0" encoding="utf-8"?>
> <targetset>
> <sitemap>
> <dir name=".">
> <document targetdoc="self">
> <include
> xmlns="http://www.w3.org/2001/XInclude";
> href="target.db"/>
> </document>
> </dir>
> </sitemap>
> </targetset>
>
> On 9/18/06, Jirka Kosek <jirka@kosek.cz> wrote:
>> Chris Chiasson wrote:
>>
>> > I guess the stylesheet calls for target.xml and the catalog says, no
>> > problem, that's right next to you - here's the URL. How does one make
>> > it use the target database catalog in the folder next to my xml files
>> > instead of next to the docbook stylesheets.
>>
>> The problem here is that for DBv5 documents stylesheets create temporary
>> document with stripped out namespace. This temporary document doesn't
>> have address, it is just temporal in-memory representation. It seems
>> that for such documents Saxon assumes that their base URI is same as of
>> stylesheet.
>>
>> If you will try olink with DBv4 content, you will see that olink target
>> database is read from the same directory as document processed.
>>
>> It is pain, I will try think about way how to fix it, but meanwhile you
>> must specify location of target database as an absolute URI.
>>
>>                         Jirka
>>
>> --
>> ------------------------------------------------------------------
>>    Jirka Kosek     e-mail: jirka@kosek.cz     http://www.kosek.cz
>> ------------------------------------------------------------------
>>    Profesionální školení a poradenství v oblasti technologií XML.
>>       Podívejte se na náš nově spuštěný web http://DocBook.cz
>>         Podrobný přehled školení http://xmlguru.cz/skoleni/
>> ------------------------------------------------------------------
>>                     Nejbližší termíny školení:
>>      ** XSLT 23.-26.10.2006 ** XML schémata 13.-15.11.2006 **
>>       ** DocBook 11.-13.12.2006 ** XSL-FO 11.-12.12.2006 **
>> ------------------------------------------------------------------
>>    http://xmlguru.cz    Blog mostly about XML for English readers
>> ------------------------------------------------------------------
>>
>>
>>
>>
>
>
> -- 
> http://chris.chiasson.name/
> 




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