Using the -v option on the XSLT command line causes
Saxon to invoke DTD validation when parsing the
stylesheet; this will normally fail, because the
stylesheet does not reference a DTD.
Applies to Saxon 8.1, 8.1.1, and 8.2.
Source fix: change the method send() at line 58 in
module net.sf.saxon.event.Sender to read:
public void send(Source source, Receiver receiver,
boolean isFinal)
throws XPathException {
receiver.setPipelineConfiguration(pipe);
receiver.setSystemId(source.getSystemId());
int validation =
(pipe.getConfiguration().isSchemaValidation() ?
Validation.STRICT : Validation.PRESERVE);
if (isFinal) {
// this ensures that the Validate command
produces multiple error messages
validation |= Validation.VALIDATE_OUTPUT;
}
XMLReader parser = null; if (source instanceof AugmentedSource) { Boolean localValidate =
((AugmentedSource)source).getSchemaValidation();
if (localValidate != null) {
validation =
(localValidate.booleanValue() ? Validation.STRICT :
Validation.PRESERVE);
}
parser =
((AugmentedSource)source).getXMLReader();
source =
((AugmentedSource)source).getContainedSource();
}
if (source instanceof NodeInfo) { if ((validation &
Validation.VALIDATION_MODE_MASK) != Validation.PRESERVE) {
try {
pipe.getErrorListener().warning(
new
TransformerException("Validation request ignored for a
NodeInfo source"));
} catch (TransformerException e) {
throw DynamicError.makeDynamicError(e);
}
}
NodeInfo ns = (NodeInfo)source;
int kind = ns.getNodeKind();
if (kind != Type.DOCUMENT && kind !=
Type.ELEMENT) {
throw new
IllegalArgumentException("Sender can only handle
document or element nodes");
}
sendDocumentInfo(ns, receiver,
pipe.getConfiguration().getNamePool());
} else if (source instanceof SAXSource) { sendSAXSource((SAXSource)source, receiver,
validation);
} else if (source instanceof DOMSource) { sendDOMSource((DOMSource)source, receiver,
validation);
} else if (source instanceof StreamSource) { StreamSource ss = (StreamSource)source; String url = source.getSystemId(); InputSource is = new InputSource(url); is.setCharacterStream(ss.getReader()); is.setByteStream(ss.getInputStream()); if (parser == null) { parser =
pipe.getConfiguration().getSourceParser();
}
SAXSource sax = new SAXSource(parser, is);
sax.setSystemId(source.getSystemId());
sendSAXSource(sax, receiver, validation);
} else {
throw new IllegalArgumentException("Unknown
type of source " + source.getClass());
}
}