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: Running the DocBook XSLT transforms from within eXist-db

There has been a problem in transforming DocBook to anything in eXist-db. The main problem is that the DocBook XSLTs cannot be loaded into eXist. There are some conflicts with the catalog in eXist.

The solution is to utilize the XPRoc Module

Install the XProc module and download the DocBook XSLT.  I recommend the docbook-xsl-ns collection http://sourceforge.net/projects/docbook/files/docbook-xsl-ns/.

install the extracted zip on the local filesystem of the eXist-db server.

The option stylesheet-path is set to the location of the XSL that you need to call.
The option db-doc-path is set to the path to the DocBook document that is to be transformed.

The XProc script is a simple one:
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
<p:option name="stylesheet-path" required="true"/>
<p:option name="db-doc-path" required="true"/>
<p:input port="source">
<p:output port="result"/>
<p:load name="load-doc">
<p:with-option name="href" select="concat('xmldb://', $db-doc-path)"/>
<p:load name="load-stylesheet">
<p:with-option name="href" select="$stylesheet-path"/>
<p:input port="source">
<p:pipe port="result" step="load-doc"/>
<p:input port="stylesheet">
<p:pipe port="result" step="load-stylesheet"/>
<p:with-param name="draft.mode" select="'no'"/>
<p:with-param name="fop.extensions" select="'0'"/>
<p:with-param name="fop1.extensions" select="'1'"/>
<p:with-param name="highlight.source" select="'1'"/>
<p:with-param name="paper.type" select="'USLetter'"/>
The XQuery code to run the transform is equally simple:
xquery version "3.0";

import module namespace xproc="http://exist-db.org/xproc";

let $simple-proc := doc('/db/myxproc/docbook-to.xpl')/*

let $fo := xproc:process($simple-proc, (
<option name="stylesheet-path" value="/docbook-xsl-ns-1.78.1/fo/docbook.xsl"/>,
<option name="db-doc-path" value="/db/db-article.xml"/>
let $pdf-binary := xslfo:render($fo'application/pdf', ())
let $stored := xmldb:store('/db''article.pdf'$pdf-binary'application/pdf')
return $stored

Loren Cahlander
GreatLinkUp, LLC

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