RE: [xsl] <xsl:include> href

Subject: RE: [xsl] <xsl:include> href
From: "Dylan Walsh" <Dylan.Walsh@xxxxxxxxxx>
Date: Thu, 3 May 2001 14:03:21 +0100
Make sure you set the System ID so the parser can resolve URLs relative
to that SystemID. See the JavaDocs.

> -----Original Message-----
> From:	Anthony Ikeda [SMTP:anthony.ikeda@xxxxxxxxxxxxxxxxxxx]
> Sent:	Wednesday, May 02, 2001 3:17 AM
> To:	XSLT
> Subject:	[xsl] <xsl:include> href
> 
> I've been working on using XSL stylesheets for a while now and created
> my
> own class to deal with the transfrmations with Xalan. I've decided
> that I
> want to use includes or imports but I'm having a few difficulties:
> 
> Using include demands an adsolute URL. If I use a relative URL, I get
> the
> following error:
> 
>     SystemId Unknown; Line 0; Column 0; Transform error:
>     javax.xml.transform.TransformerException: SAX Exception
> 
> My transformation code is:
> 
> /**
>  * Xml String used to transform.
>  */
>   public String xmlStr = new String();
> /**
>  * XSL String used for transformations.
>  */
>   public String xslStr = new String();
> 
>   public void transformText(PrintWriter out, String xslFileIn, String
> xmlString){
>     ...
>       XSLTProcessor xsltprocessor =
> XSLTProcessorFactory.getProcessor();
>       StringReader strrdXML = new StringReader(xmlStr);
>       StringReader strrdXSL = new StringReader(xslStr);
> 
>       xsltprocessor.process(new XSLTInputSource(strrdXML), new
> XSLTInputSource(strrdXSL), new XSLTResultTarget(out));
>     ...
>   }
> 
> I'm calling this class from a servlet.
> 
> My xsl is:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:param name="status">OK</xsl:param>
> <xsl:include href="styles.xsl"/>
> 
> If I add the absolute URL then it works fine, but I don't want to have
> to
> manually update this each time I use my software on a different
> webserver.
> 
> How can I avoid this?
> 
> Cheers,
> Anthony Ikeda
> Web Application Developer,
> Proxima Technology Pty. Ltd.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread