[oXygen-user] Catalogs, XML Calabash and Saxon

George Bina
Tue Mar 29 07:52:28 CDT 2016


Hi Wendell,

I was not able to reproduce the problem based on your description. Here 
it is what I did:

I created a catalog which specifies another catalog as next catalog and 
that provides a mapping from a public identifier to a DTD file.

catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
     <nextCatalog catalog="catalog2.xml"/>
</catalog>

catalog2.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
     <public publicId="testpublic" uri="dtd/test.dtd"/>
</catalog>

The DTD declares a test element with a default attribute, so we can see 
that added when we copy the document content with the XSLT script

test.dtd
<!ELEMENT test ANY>
<!ATTLIST test att CDATA "value">

Then I created an XSLT script that uses the collection function to copy 
the test.xml content:

test.xsl
<?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:template match="/">
         <xsl:apply-templates select="collection('collection.xml')/*" 
mode="copy"/>
     </xsl:template>

     <xsl:template match="node() | @*" mode="copy">
         <xsl:copy>
             <xsl:apply-templates select="node() | @*" mode="#current"/>
         </xsl:copy>
     </xsl:template>

</xsl:stylesheet>

collection.xml
<collection stable="true">
    <doc href="test.xml"/>
</collection>

When run, this stylesheet will return:

<test att="value">george</test>

Now, I created an XProc script which runs the same stylesheet:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
     xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
     <p:input port="source">
         <p:inline>
             <doc>Hello world!</doc>
         </p:inline>
     </p:input>
     <p:output port="result"/>
     <p:xslt>
         <p:input port="parameters">
             <p:empty/>
         </p:input>
         <p:input port="stylesheet">
             <p:document href="test.xsl"/>
         </p:input>
     </p:xslt>
</p:declare-step>

and the result is the same:

<test att="value">george</test>

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 25/03/16 20:53, Wendell Piez wrote:
> Hi,
>
> I have a catalog set up for my project, which calls another catalog on
> my system, which resolves FPIs to paths.
>
> When I validate a document calling one of the DTDs at the far end of
> this chain, it works -- oXygen finds the DTD and validates the file.
>
> Same thing when the same document is called in via the collection()
> function in an XSLT - the file parses. (Plus, I know the DTD is looked
> for and found because if I break the link by changing the FPI, it is
> not found and I get an error. Plus if I set oXygen to show me its
> catalog lookups, there they are.)
>
> However, when I run the same stylesheet inside an XProc pipeline run
> by Calabash inside oXygen, I get an error "this document will be
> excluded from the collection" and a message to the effect that the DTD
> could not be found.
>
> What am I missing? Apparently while XML Calabash will use the catalog,
> and Saxon will use the catalog, Saxon-inside-Calabash will not?
>
> Does anyone have any insight or workarounds to share?
>
> Cheers, Wendell
>


More information about the oXygen-user mailing list