[Home]  [List]  [News]  [Docs]  [FAQ]  [Downloads]  [Resources]  [About]
Search :
/Home /List

list4xt : Mailing list for the XT users community.

[list4xt] Re: handling stylesheet errors

Subject: [list4xt] Re: handling stylesheet errors

User: Website

From: Lorenzo Gallucci (wes74@engineer.com)
Date: 24/07/2001 - 10:01


In stardate Wed, 11 Jul 2001 12:02:39 -0700,
    guy <guy@polylab.sfu.ca> sent a message through subspace...
> I deleted the original email but someone was asking about finding errors
> in your
> stylesheet.
I don't if this is an answer to my post "More precise error location" ...
I will suppose yes, it is ;)
> I think you have to specify the exception in your
> XSLTServlet.
> Here is the code I use:
>
>
> try {
> cached.loadStylesheet(new
> InputSource(getServletContext().getResource(stylesheet).toString()));
> }
> catch (SAXParseException e) {
> System.out.println("Error in " + e.getSystemId() +
> " at line " + e.getLineNumber() +
> " column " + e.getColumnNumber());
> throw new ServletException(e);
> }
> catch (SAXException e) {
> System.out.println("*SAXEXCEPTION*");
> throw new ServletException(e);
> }
> catch (IOException e) {
>
> System.out.println("*IOEXCEPTION*");
> throw new ServletException(e);
> }
> Please let me know if this is any help.
Thank you for the advice... unfortunately it doesn't help, though ;(
I do not use a Servlet for this purpose, but the error-catching code I
wrote has the same scheme of the code you proposed.
The problem is in the following method in
com.jclark.xsl.expr.VariantBase:

---
 public NodeIterator convertToNodeSet() throws XSLException {
    throw new XSLException("cannot convert to node-set");
  }
---
The XSLException thrown hasn't the second parameter ("node"), found
instead in this method of com.jclark.xsl.expr.GlobalVariableRefExpr:
---
 public Variant eval(Node sourceNode, ExprContext context) throws
XSLException {
    Variant value = context.getGlobalVariableValue(name);
    if (value != null)
      return value;
    throw new XSLException("variable \"" + name + "\" not defined",
			   node);
  }
----
This leads to NO location information (as I can guess) for VariantBase
error, while the exception thrown in second code snippet I reported has
location information as well as error message.

My question is: how can I modify code to get location information also for "cannot convert to node-set" error message of VariantBase?

Thanks --------------------------------------------------------------- \\//_ Live long and prosper and ... HAVE A GOOD TIME! ;-) Lorenzo Gallucci - wes74@engineer.com - ICQ# 19194057 --- Wenn die Nacht am tiefsten ist, ist der Tag am nächsten ---

-- Mailing list for the XT users community. (http://dclickads.com) (mailto:list4xt-request@4xt.org?Subject=unsubscribe to unsubscribe)



Archive générée par hypermail 2b28 le 06/11/2001 - 11:46 CET

webmaster@4xt.org