[xsl] <xsl:include> href

Subject: [xsl] <xsl:include> href
From: "Anthony Ikeda" <anthony.ikeda@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 2 May 2001 12:16:43 +1000
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


Current Thread