Simulate interface URIResolver while editing

Here should go questions about transforming XML with XSLT and FOP.
claudio
Posts: 3
Joined: Thu Dec 14, 2006 11:19 am

Simulate interface URIResolver while editing

Post by claudio »

Hello all
I'm evaluating oxygen editor plugin 8.0 with Eclipse 3.2.
My web appl run on Tomcat and we use Xalan to transform at runtime.
We use XSLT to generate HTML. The structure of my project is like the one

Code: Select all

<workspc>--+-MyApp
+--src
+--websource
+--- MyFile.xsl
+--- MyFile.xml
my XSL Stylesheet "MyFile.xsl" is something like this:

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="/MyApp/generalsettings.xsl" /> <<<<<<------- Error: IO exception

<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="baseListe"/>
</xsl:template>

[snip...]
While editing I would like to try to do a transform and test my "MyFile.xsl" in the Oxygen perspective, but the editor tell me that he cannot find the import file "/MyApp/generalsettings.xsl".
In the scenario I did not find any indication where to specify the root path, how to tell the
"URIResolver" interface where is my root, simulate an HTTP request with the root on $myworkspc//MyApp/websource.
Can anyone tell me what the "best practice" for using Oxygen in that context
Thanks in advance
Claudio
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Dear Cladio,

In order to accomplish this you need to use catalog support.

Just create a file called for example "testCatalog.xml" and save in it the content below.
Of course you have to modify the value of the "rewritePrefix" attribute to the real path on your system.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="/MyApp" rewritePrefix="file:///home/workspace/MyApp"/>
</catalog>
Then go to Oxygen preferences -> XML -> XML Catalog page, press New and add the new file "testCatalog.xml" to the catalogs list.
Then restart the application.

Read more about Oxygen catalog support here:
http://www.oxygenxml.com/doc/ug-oxygenE ... alogs.html

After this, validating and transforming the stylesheet should resolve the href through the new catalog to the real file.

Hope this helps,
Regards, Radu
claudio
Posts: 3
Joined: Thu Dec 14, 2006 11:19 am

Post by claudio »

Hi Radu
Thank for your reply, but it still is not working.
With this situation I continue to get I/O Exception !?

Code: Select all

<wrkspc>/elabora/webapps
+-- elabora.xsl
+--/abilitazione
+--HTVUtente.xsl
+--HTVUtente.xml
+--/META-INF
+--testCatalog.xml

my stylesheet file: <wrkspc>/elabora/webapps/abilitazione/HTVUtente.xsl

Code: Select all

<xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:import href="/elabora/elabora.xsl" /> <<<<<<<--- I/O error
<xsl:output method="html" indent="yes"/>

<xsl:template match="/">
<xsl:call-template name="baseListe"/>
</xsl:template>
[snip....]
my catalog file:<wrkspc>/elabora/webapps/META-INF/testCatalog.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="/elabora"
rewritePrefix="file://c:/java/sviluppo2.0/elabora/webapps"/>
</catalog>
claudio
Posts: 3
Joined: Thu Dec 14, 2006 11:19 am

Post by claudio »

Hi Radu
I was wrong with the:
rewritePrefix="file://c:/java/...
:oops: I forgot that in a URI you have to specify a hostname or nothing, so the correct URI is
rewritePrefix="file:///c:/java/...
With this correction now it works fine !!!
Thanks to your help
Post Reply