xsl-list
[Top] [All Lists]

Re: [xsl] resolving relative path without base

2007-05-29 08:54:27
On 5/29/07, Kai Hackemesser <kaha(_at_)gmx(_dot_)de> wrote:
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("/lrPreTransformHtml.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?

Call setSystemId() on the StreamSource used to read the stylesheet, eg:

src.setSystemId(path to xslt);

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--