xsl-list
[Top] [All Lists]

RE: <xsl:include> using relative paths and Saxon 8

2006-01-20 10:05:23
Andrew was right. You aren't giving Saxon a URL here, all you're giving it
is an InputStream. Since Saxon has no idea where the InputStream came from,
it can't resolve anything relative to it. Do

xslSource.setSystemId(xsltUrl)

and you should be fine.

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

-----Original Message-----
From: Chris Ward [mailto:cward(_at_)horizon-asset(_dot_)co(_dot_)uk] 
Sent: 20 January 2006 16:49
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] <xsl:include> using relative paths and Saxon 8



It's likely you'll need to call setSystemId() on the 
StreamSource, or on the TransformerHandler (if you are using 
either of them).

      Err... okay - will look into this.

If not, post the part of your code that loads the stylesheet.

      Here's an outline of what I'm doing 

      - - - - - - - - - - - - - - - - - - - - - - - - - - - 

            URL url = new URL(xsltUrl);
            URLConnection urlConn = url.openConnection();

              InputStream is = urlConn.getInputStream();
              Source xslSource = new StreamSource(is);

              TransformerFactory transFact =
TransformerFactory.newInstance();
              Templates templates = transFact.newTemplates(xslSource);

              Transformer transformer = templates.newTransformer();


              <snip>

            DocumentSource source = new DocumentSource(getDocument());
            DocumentResult result = new DocumentResult();
            try {
                transformer.transform(source, result);
                if (DEBUG) {
                    System.out.println("transformer.transform()
succeeded");
                }
            }
            catch (TransformerException ex) {
                // transformation failed somehow - should log this
                if (DEBUG) {
                    System.out.println("transformer.transform()
failed");
                }
            }
            // should I have a finally block?
            this.transformedDocument = result.getDocument();

      - - - - - - - - - - - - - - - - - - - - - - - - - - - 




--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>
--~--