Testing a catalog

Having trouble installing Oxygen? Got a bug to report? Post it all here.
FJJCENT
Posts: 25
Joined: Sun Apr 22, 2018 10:17 pm

Testing a catalog

Post 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
Last edited by FJJCENT on Tue Feb 01, 2022 4:59 pm, edited 1 time in total.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Testing a catalog

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
FJJCENT
Posts: 25
Joined: Sun Apr 22, 2018 10:17 pm

Re: Testing a catalog

Post 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
FJJCENT
Posts: 25
Joined: Sun Apr 22, 2018 10:17 pm

Re: Testing a catalog

Post by FJJCENT »

I tried also with
<xsl:variable name="rutaDocumentoEntrada"
select="document('http://www.animales/domesticos/europa/perros.xml')" />


but also not result
FJJCENT
Posts: 25
Joined: Sun Apr 22, 2018 10:17 pm

Re: Testing a catalog

Post 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
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Testing a catalog

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply