[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: resolving relative path without base

Subject: Re: resolving relative path without base
From: Kai Hackemesser <kaha@xxxxxx>
Date: Wed, 30 May 2007 12:00:33 +0200
Re:  resolving relative path without base
Good morning, Michael,

I'm using JDK 1.4.2 with it's transformation engine.

Regards,
Kai

Michael Kay schrieb:
I would expect that when you call setSystemID() on the StreamSource, the
URIResolver would see that value in the "base" argument.

What product are you using?

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Kai Hackemesser [mailto:kaha@xxxxxx] Sent: 30 May 2007 09:53
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: resolving relative path without base


Hi, Michael,

I tried that but wasn't successful. I have added an URI resolver to the transformer factory, because I want to lookup the xsl sources from different jar files. As you told I'v set systemID from the xsl source to an appropriate value, but the uri resolver get called with base=null and so I can't find it because href is an relative URI ("../../project.xsl"). How do I get my resolve method called with base != null, or href not relative?

Ciao!
Kai

Michael Kay schrieb:
Use StreamSource.setSystemId() to define the base URI.

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Kai Hackemesser [mailto:kaha@xxxxxx] Sent: 29 May 2007 16:43
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: resolving relative path without base


Thanks, I tried that and it looks good.

But now I have a problem with relative links. My task is as follows: I have to create a xsl depending on some xml input. The resulting xsl file will import another xsl (depending on input from first xml file).

This is my code so far:

// loading preprocess XSL
StreamSource src = new
StreamSource(getClass().getResourceAsStream("/lrPreTransformHt
ml.xsl"));
// loading xml
StreamSource xml = new StreamSource(new ByteArrayInputStream(out.toByteArray()));
StreamResult result = new StreamResult(outRes); // create Transformer from factory and transform.
getTransformer(src).transform(xml,result);
// transform again and display


htmlPane.setText(transform(out.toByteArray(),outRes.toByteArray()));
The problem currently appearing is that the xsl file imported into the preprocess-created xsl stream also imports a xsl file - and since I now have only a ByteStream as Source, I lost the relativeness to that imported file. Is there another way than giving an absolute address in that import? Like setting a base url in FOP?

Kind regards,
Kai

M. David Peterson schrieb:
On Tue, 29 May 2007 06:35:47 -0600, Kai Hackemesser
<kaha@xxxxxx> wrote:
Has anybody seen an example how to create xsl output with xsl?
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:element name="xsl:stylesheet">
<xsl:attribute
ame="xmlns:xsl">http://www.w3.org/1999/XSL/Transform</xsl:attribute>
      <xsl:attribute name="version">1.0</xsl:attribute>
      <xsl:element name="xsl:template">
        <xsl:attribute name="match">/</xsl:attribute>
        <xsl:element name="xsl:apply-templates"/>
      </xsl:element>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.