Local recources and XSLT

Here should go questions about transforming XML with XSLT and FOP.
Ievhen
Posts: 2
Joined: Thu Jan 10, 2013 7:53 pm

Local recources and XSLT

Post by Ievhen »

I've used Visual Studio for editing / debugging XSLTs but found Oxygen more friendly.

But I cannot use local resources via importing them to XSLT using Oxygen:

Code: Select all

<xsl:import href="C:\Inetpub\wwwroot\wss\VirtualDirectories\80\Settings\StandardBlaBlaBlaXSLTFile.xslt"/>
Oxygen throw next error:
E [Saxon6.5.5] Malformed URL C:\Inetpub\wwwroot\wss\VirtualDirectories\80\Settings\StandardBlaBlaBlaXSLTFile.xslt(base file:/C:/Work/Test.xslt) - unknown protocol: c

It works fine when I put StandardBlaBlaBlaXSLTFile.xslt file to my C:/Work folder (near to tested Test.xslt) and include it via:

Code: Select all

<xsl:import href="StandardBlaBlaBlaXSLTFile.xslt"/>
But this way is not acceptable for me.

Is there any way to include local XSLT resources to Project (or globally to any XSLT that will be edited in Oxygen)?
ionela
Posts: 402
Joined: Mon Dec 05, 2011 6:08 pm

Re: Local recources and XSLT

Post by ionela »

Hello,

Please note that as per xsl:import specification the href attribute value should be a URI reference (absolute URI or relative URI):
http://www.w3.org/TR/xslt#import

A workaround is to use an XML Catalog to map the path of stylesheet that you want to import to an URI.

For example the XML Catalog below maps the stylesheet's path to a relative URI. In this case, you need to save the XML Catalog relative to the path that you are mapping (in the same location with StandardBlaBlaBlaXSLTFile.xslt).

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="C:\Inetpub\wwwroot\wss\VirtualDirectories\80\Settings\" rewritePrefix="."/>
</catalog>
Or you can redirect the path to an absolute URI, and the XML catalog can be saved anywhere else.

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="C:\Inetpub\wwwroot\wss\VirtualDirectories\80\Settings\" rewritePrefix="file:/C:/Inetpub/wwwroot/wss/VirtualDirectories/80/Settings/"/>
</catalog>
After you've created your XML catalog you need to add it to Option -> Preferences -> XML -> XML Catalog.

Let us know if you need further assistance.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
Ievhen
Posts: 2
Joined: Thu Jan 10, 2013 7:53 pm

Re: Local recources and XSLT

Post by Ievhen »

Thx a lot. Your recommendations are awesome - I've solved problem via adding catalog.
Post Reply