RE: [xsl] SAXON 8 - Error at element constructor

Subject: RE: [xsl] SAXON 8 - Error at element constructor
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 25 Jan 2005 16:50:41 -0000
You need to call setSystemId() on the StreamSource object so that there is a
known base URI against which the relative URI can be resolved.

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


> -----Original Message-----
> From: Tommy Skarateppen [mailto:ts@xxxxxxxxxxxx] 
> Sent: 25 January 2005 16:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] SAXON 8 - Error at element constructor
> 
> The static-base-uri() doesn't say anything. I get an empty string.
> 
> If it is relevant to the problem, this is what I do in my 
> java class (the
> xml-file is buildt on the fly from data in a database):
> 
> ServletContext ctx = getServletContext();
> ...
> 
> TransformerFactory tFactory = new 
> net.sf.saxon.TransformerFactoryImpl();
> xslFilePath = ctx.getRealPath("/resources/stylesheet.xsl");
> 
> StreamSource xslSrc = new StreamSource(new 
> FileInputStream(xslFilePath));
> xslTransformer = tFactory.newTransformer(xslSrc);
> ...
> 
> xslTransformer.transform(new StreamSource(new
> StringReader(form.toStringWithEvents())), new StreamResult(out));
> 
> 
> -----Opprinnelig melding-----
> Fra: Michael Kay [mailto:mike@xxxxxxxxxxxx] 
> Sendt: 25. januar 2005 13:42
> Til: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Emne: RE: [xsl] SAXON 8 - Error at element constructor
> 
> 
> The error message comes from the Java URL library.
> 
> Is the base URI of the stylesheet known? This depends on how 
> you invoke the
> transformation. Try calling static-base-uri() to see what it says. The
> actual relative URI passed to unparsed text looks fine, so I think the
> problem is with the base URI.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> > -----Original Message-----
> > From: Tommy Skarateppen [mailto:ts@xxxxxxxxxxxx]
> > Sent: 25 January 2005 12:28
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE: [xsl] SAXON 8 - Error at element constructor
> > 
> > Sorry, I have the unparsed-text() function in my stylesheet,
> > which I added
> > just for testing, and forgot to remove it. I was confused 
> by the error
> > message, so I didn't see that the function was still there.
> > 
> > But anyway, I'm planning to use this function in my
> > stylesheet, but I don't
> > understand the error "XT1170: Cannot resolve relative URI: no 
> > protocol:". 
> > 
> > What does it mean and why do I get it?
> > 
> > I tried this in my stylesheet:
> > <xsl:value-of select="unparsed-text('help/print.html', 
> 'iso-8859-1')" 
> > disable-output-escaping="yes"/>
> > 
> > Is it possible to use an http request (e.g.
> > http://www.foo.com/help/print.html) as argument to the 
> unparsed-text() 
> > function (I haven't been able to make that work either)?
> > 
> > -Tommy
> > 
> > -----Opprinnelig melding-----
> > Fra: Michael Kay [mailto:mike@xxxxxxxxxxxx]
> > Sendt: 25. januar 2005 00:25
> > Til: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Emne: RE: [xsl] SAXON 8 - Error at element constructor
> > 
> > 
> > The error XT1170 comes from a call on the unparsed-text()
> > function. The text
> > 
> > "2005-01-24 16:40:30,437 52219 WARN  
> no.docstream.formstream.GetForm"
> > 
> > is the message associated with an exception from the
> > java.net.URL class -
> > it's possible this is actually the URL you supplied as the 
> > argument to the
> > function.
> > 
> > I can't see you you could get this error from a stylesheet
> > that you haven't
> > changed from XSLT 1.0.
> > 
> > I hope this helps you identify where the error originated.
> > 
> > Michael Kay
> > http://www.saxonica.com/
> >  
> > 
> > > -----Original Message-----
> > > From: Tommy Skarateppen [mailto:ts@xxxxxxxxxxxx]
> > > Sent: 24 January 2005 16:17
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: [xsl] SAXON 8 - Error at element constructor
> > > 
> > > I'm getting this error when I transform using SAXON 8:
> > > 
> > > Error at element constructor <td> on line 572 of :
> > >   XT1170: Cannot resolve relative URI: no protocol: 2005-01-24 
> > > 16:40:30,437 52219 WARN
> > > no.docstream.formstream.GetForm  Unable
> > > to perform XSL transformationnet.sf.saxon.xpath.DynamicError: 
> > > Cannot resolve
> > > relative URI
> > > 
> > > I've used the same xsl in my application for two years now, and 
> > > never had problems with the transformation and I haven't changed
> > > anything. I'm going
> > > to add some xsl 2.0 features in my stylesheet, so I had to 
> > > use the SAXON 8.
> > > And now I get this error from the Tomcat log.
> > > 
> > > This is what I have on line 572 in my xsl:
> > > 
> > > <td valign="top">
> > > 
> > > Just a common html-tag with a common attribute.
> > > 
> > > Does anyone have an idea what causing this error?
> > > 
> > > -Tommy

Current Thread