From: Michael Kay <mhk@mh...> - 2003-09-05 10:40:40
> I think this will be a straightforward reply, but we are
> trying to move from Xalan to Saxon at present and have a
> problem when we have <xsl:attribute> for a result but it is
> not encapsulated by <xsl:element>. In Xalan we get a warning
> of "Illegal attribute name : xxxxxx" but the result is
> returned anyway. In Saxon however we are getting :
> Recoverable error
> at xsl:attribute on line 3 of
> Cannot write an
> attribute node when no element start tag is open
> and the result is not returned. Unfortunately, while the
> obvious and clean solution is to adapt the XSL formulae, the
> problem is that we have over a 1000 and the process would not
> be simple(formulae were originially created before
> encountering or forseeing this problem). Could you tell me
> if there is a way around this in Saxon other than altering
> the formulae?
The XSLT spec defines this as a recoverable error, the processor is
allowed to report an error, and/or to recover by not writing the
You can configure Saxon with:
-w0 take the recovery action and don't report the error
-w1 report a warning and take the recovery action (this is the default)
-w2 report the error and stop
There are equivalent switches in the Java API.
What you can't do is get Saxon to actually output the attribute. That
would be non-conformant with the spec (and impossible given the way
Saxon pipelines the result tree straight into the serializer).
> Another small query - I remember seeing somewhere in the
> documentation that you can set Saxon to nonValidate or
> something similar so that it does not need to load and check
> the DTD but I cannot find it again. Is this correct and if
> so I'd really appreciate a pointer to the documentation or
> the method to do this?
That's a function of the XML parser, not of Saxon itself. Generally, if
there is a DTD then it will be loaded and read (to expand entities) but
will not be used for validation unless you set the -v flag on the Saxon
command line, or configure the parser directly yourself.
From: Michael Kay <mhk@mh...> - 2003-09-05 17:24:31
> It must read the internal subset of the DTD, but not the
> external/referenced DTD: http://www.w3.org/TR/REC-xml#proc-types
> "Non-validating processors are required to check only the document
> entity, including the entire internal DTD subset, for
> The rest of the paragraph is quirky, but I can't see that a
> non-validating parser ever must read the external DTD.
Non-validating parsers are not required to read the DTD, but I think
that they almost invariably do so, because of the issues Trevor
But whatever they do or don't do, there's nothing specific in Saxon to
control it: if you want to configure the way the XML parser behaves, you
have to do it yourself, typically by supplying a preconfigured parser
wrapped in a SAXSource.