Docbook XSLT transformation
Posted: Tue Feb 28, 2023 12:19 pm
Hello,
I would like to create an XSL that resolves xi:include in a docbook document to get a single merged file.
In Oxygen I just use a transformation scenario with Saxon HE 11.4 with an identity XSL and it works like a charm:
But when I tried to execute the same transformation in command line (outside of Oxygen) it doesn't work.
I get the following error:
It seems that the problem comes from doctype. Because if i remove it, it works!
I don't understand the difference between inside and outside execution.
Thanks for any help.
Regards
I would like to create an XSL that resolves xi:include in a docbook document to get a single merged file.
Code: Select all
<!DOCTYPE book
PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://docbook.org/xml/4.3/docbookx.dtd"[
<!-- Will use "m" as a prefix.-->
<!ENTITY % equation.content "(alt?, (graphic|mediaobject|m:math)+)">
<!ENTITY % inlineequation.content "(alt?, (graphic|inlinemediaobject|m:math)+)">
<!ENTITY % NS.prefixed "INCLUDE">
<!ENTITY % MATHML.prefix "m">
<!ENTITY % NamespaceDecl.attrib "
xmlns:m
CDATA #FIXED 'http://www.w3.org/1998/Math/MathML'
">
<!-- Include the MathML DTD -->
<!ENTITY % mathml PUBLIC "-//W3C//DTD MathML 3.0//EN"
"http://www.w3.org/TR/MathML3/dtd/mathml3.dtd">
%mathml;
<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod" >
%xinclude;
]>
<book id="001" remap="FE" role="prosub" vendor="0000141792">
<title>XXX</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="xxx.xml"><xi:fallback><!--Fallback markup for "x-wc://file=0000141793.xml"--></xi:fallback></xi:include>
</book>
Code: Select all
<?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"
xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math"
version="2.0">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Code: Select all
java -cp "C:\xxx\Saxon-HE-main\11\Java\SaxonHE11-4J\saxon-he-11.4.jar" net.sf.saxon.Transform -xsl:"C:\xxx\flat.xsl" -s:"C:\xxx\book43.xml" -o:"c:/temp/xxx/out.xml" -t -xi:on -catalog:"C:\Program Files\Oxygen XML Editor 25 - 3\frameworks\docbook\catalog.xml"
Code: Select all
SaxonJ-HE 11.4 from Saxonica
Java version 11.0.10
Stylesheet compilation time: 303.1586ms
Processing file:/C:/xxx/book43.xml
Using parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Building tree for file:/C:/xxx/book43.xml using class net.sf.saxon.tree.tiny.TinyBuilder
I/O error reported by XML parser processing file:/C:/xxx/book43.xml
I don't understand the difference between inside and outside execution.
Thanks for any help.
Regards