Page 1 of 1

Testing a catalog

Posted: Tue Feb 01, 2022 3:03 pm
by FJJCENT
Because the catalog is not working well I needed to use absolute address in my project. but now I try to understand how catalog works with Oxygen Xml Editor so I've created a very simple example but it doens't work and I try to know why, so I explain my test
the root of the xml file is:
<?xml version="1.0" encoding="utf-8"?>
<perros xmlns="http://www.animales/domesticos/europa">
<perro raza="collie" chip="01">sam</perro>
<perro raza="chihahua" chip="02">lazy</perro>
<perro raza="fox-terrier" chip="03">fenguy</perro>
<perro raza="coker spaniel" chip="04">laika</perro>
</perros>


the catalog includes
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/en ... atalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<rewriteURI uriStartString="http://www.animales/domesticos/europa" rewritePrefix="C:/Trabajo/Historico/Prueba_Catalogos" />
</catalog>


and the XSL file includes
<xsl:variable name="rutaDocumentoEntrada" select="concat('http://www.animales/domesticos/europa', '/perros', '.xml')" />
I try that the variable rutaDocumentoEntrada takes the file from the ubication of the xml File (c:\Trabajo) the same directory where the catalog is.

I Look for the result C:/Trabajo/Historico/Prueba_Catalogos\Perros.xml
but the result is always http://www.animales/domesticos/europa/perros.xml' (so the catalog doesn't work)

Could you please tell me where is my fail
Best Regards

Re: Testing a catalog

Posted: Tue Feb 01, 2022 4:58 pm
by Radu
Hi,

Your "rutaDocumentoEntrada" xsl variable has a plain string value, the XSLT processor does not resolve any string value through the XML catalog support.
The XSLT "document" function should pass the referenced location through the URI resolver:

Code: Select all

<xsl:variable name="var" select="document(concat('http://www.animales/domesticos/europa', '/perros', '.xml'))"/>
https://www.saxonica.com/html/documenta ... ument.html

and you should get in the $var the entire loaded XML contents.

Regards,
Radu

Re: Testing a catalog

Posted: Tue Feb 01, 2022 6:20 pm
by FJJCENT
I am very sorry I tried with your way but the result is not OK the catalog doesn't change anything
XSL:
<xsl:variable name="rutaDocumentoEntrada"
select="document(concat('http://www.animales/domesticos/europa', '/perros', '.xml'))" />

Result:
http://www.animales/domesticos/europa/perros.xml

Re: Testing a catalog

Posted: Tue Feb 01, 2022 6:26 pm
by FJJCENT
I tried also with
<xsl:variable name="rutaDocumentoEntrada"
select="document('http://www.animales/domesticos/europa/perros.xml')" />


but also not result

Re: Testing a catalog

Posted: Tue Feb 01, 2022 6:45 pm
by FJJCENT
Solved, your solution was correct, there was also a problem with the catalog configuración, was configured for project options, moving to global options it worked.

Many thanks
Francisco

Re: Testing a catalog

Posted: Wed Feb 02, 2022 8:18 am
by Radu
Hi Francisco,

I'm glad this works for you, not sure why it did not work with the XML catalog placed at project level, it should have worked just as well as long as Oxygen properly managed to resolve the path tot he XML catalog. In this case with the XML catalog saved at project level the path to the XML catalog could have been ${pdu}/relative/path/to/catalog.xml as "${pdu}" resolves to the current project folder in URL syntax.

Regards,
Radu