String[] parts;
try {
parts = checker.getQNameParts(value);
String prefix = parts[0];
if (prefix.length() == 0) {
XPathException err = new XPathException("method must be xml, html, xhtml, or text, or a prefixed name");
err.setErrorCode("XTSE1570");
err.setIsStaticError(true);
throw err;
} else {
String muri = nsResolver.getURIForPrefix(prefix, false);
if (muri==null) {
XPathException err = new XPathException("Namespace prefix '" + prefix + "' has not been declared");
err.setErrorCode("XTSE1570");
err.setIsStaticError(true);
throw err;
}
details.setProperty(OutputKeys.METHOD, '{' + muri + '}' + parts[1]);
}
} catch (QNameException e) {
XPathException err = new XPathException("Invalid method name. " + e.getMessage());
err.setErrorCode("XTSE1570");
err.setIsStaticError(true);
throw err;
}
}
} else
if (lname.equals(StandardNames.OUTPUT_VERSION) || lname.equals(StandardNames.VERSION)) {
details.setProperty(OutputKeys.VERSION, value);
} else
if (lname.equals(StandardNames.BYTE_ORDER_MARK)) {
if (prevalidated || value.equals("yes") || value.equals("no")) {
details.setProperty(SaxonOutputKeys.BYTE_ORDER_MARK, value);
} else {
XPathException err = new XPathException("byte-order-mark value must be 'yes' or 'no'");
err.setErrorCode("XTDE0030");
throw err;
}
} else
if (lname.equals(StandardNames.INDENT)) {
if (prevalidated || value.equals("yes") || value.equals("no")) {
details.setProperty(OutputKeys.INDENT, value);
} else {
XPathException err = new XPathException("indent must be 'yes' or 'no'");
err.setErrorCode("XTDE0030");
throw err;
}
} else
if (lname.equals(StandardNames.ENCODING)) {
details.setProperty(OutputKeys.ENCODING, value);
} else
if (lname.equals(StandardNames.MEDIA_TYPE)) {
details.setProperty(OutputKeys.MEDIA_TYPE, value);
} else
if (lname.equals(StandardNames.DOCTYPE_SYSTEM)) {
details.setProperty(OutputKeys.DOCTYPE_SYSTEM, value);
} else
if (lname.equals(StandardNames.DOCTYPE_PUBLIC)) {
details.setProperty(OutputKeys.DOCTYPE_PUBLIC, value);
} else
if (lname.equals(StandardNames.OMIT_XML_DECLARATION)) {
if (prevalidated || value.equals("yes") || value.equals("no")) {
details.setProperty(OutputKeys.OMIT_XML_DECLARATION, value);
} else {
XPathException err = new XPathException("omit-xml-declaration attribute must be 'yes' or 'no'");
err.setErrorCode("XTDE0030");
throw err;
}
} else
if (lname.equals(StandardNames.STANDALONE)) {
if (prevalidated || value.equals("yes") || value.equals("no") || value.equals("omit")) {
details.setProperty(OutputKeys.STANDALONE, value);
} else {
XPathException err = new XPathException("standalone attribute must be 'yes' or 'no' or 'omit'");
err.setErrorCode("XTDE0030");
throw err;
}
} else
if (lname.equals(StandardNames.CDATA_SECTION_ELEMENTS)) {
String existing = details.getProperty(OutputKeys.CDATA_SECTION_ELEMENTS);
if (existing == null) {
existing = "";
}
String s = parseListOfElementNames(value, nsResolver, prevalidated, checker, "XTDE0030");
details.setProperty(OutputKeys.CDATA_SECTION_ELEMENTS, existing + s);
} else
if (lname.equals(StandardNames.USE_CHARACTER_MAPS)) {
// The use-character-maps attribute is always turned into a Clark-format name at compile time
String existing = details.getProperty(SaxonOutputKeys.USE_CHARACTER_MAPS);
if (existing == null) {
existing = "";
}
details.setProperty(SaxonOutputKeys.USE_CHARACTER_MAPS, existing + value);
} else
if (lname.equals(StandardNames.UNDECLARE_PREFIXES)) {
if (prevalidated || value.equals("yes") || value.equals("no")) {
details.setProperty(SaxonOutputKeys.UNDECLARE_PREFIXES, value);
} else {
XPathException err = new XPathException("undeclare-namespaces value must be 'yes' or 'no'");
err.setErrorCode("XTDE0030");
throw err;
}
} else
if (lname.equals(StandardNames.INCLUDE_CONTENT_TYPE)) {
if (prevalidated || value.equals("yes") || value.equals("no")) {
details.setProperty(SaxonOutputKeys.INCLUDE_CONTENT_TYPE, value);
} else {
XPathException err = new XPathException("include-content-type attribute must be 'yes' or 'no'");
err.setErrorCode("XTDE0030");
throw err;
}
} else
if (lname.equals(StandardNames.ESCAPE_URI_ATTRIBUTES) || lname.equals("escape-uri-attibutes")) {
// misspelling was in Saxon 9.0 and previous releases
if (prevalidated || value.equals("yes") || value.equals("no")) {
details.setProperty(SaxonOutputKeys.ESCAPE_URI_ATTRIBUTES, value);
} else {
XPathException err = new XPathException("escape-uri-attributes value must be 'yes' or 'no'");
err.setErrorCode("XTDE0030");
throw err;
}
} else
if (lname.equals(StandardNames.NORMALIZATION_FORM)) {
if (Name11Checker.getInstance().isValidNmtoken(value)) {
// if (prevalidated || value.equals("NFC") || value.equals("NFD") ||
// value.equals("NFKC") || value.equals("NFKD")) {
details.setProperty(SaxonOutputKeys.NORMALIZATION_FORM, value);
} else if (value.equals("none")) {
// do nothing
} else {
XPathException err = new XPathException("normalization-form must be a valid NMTOKEN");
err.setErrorCode("XTDE0030");
throw err;
}
} else {
// Normally detected statically, but not with saxon:serialize
XPathException err = new XPathException("Unknown serialization property " + lname);
err.setErrorCode("XTDE0030");
throw err;
}
} else if (uri.equals(NamespaceConstant.SAXON)) {
if (lname.equals("character-representation")) {
details.setProperty(SaxonOutputKeys.CHARACTER_REPRESENTATION, value);
} else
if (lname.equals("indent-spaces")) {
try {
Integer.parseInt(value);
details.setProperty(OutputKeys.INDENT, "yes");
details.setProperty(SaxonOutputKeys.INDENT_SPACES, value);
} catch (NumberFormatException err) {
XPathException e = new XPathException("saxon:indent-spaces must be an integer");
e.setErrorCode(NamespaceConstant.SAXON, SaxonErrorCode.SXWN9002);
throw e;
}
} else
if (lname.equals("suppress-indentation")) {
String existing = details.getProperty(SaxonOutputKeys.SUPPRESS_INDENTATION);
if (existing == null) {
existing = "";
}
String s = parseListOfElementNames(value, nsResolver, prevalidated, checker, "XTDE0030");
details.setProperty(SaxonOutputKeys.SUPPRESS_INDENTATION, existing + s);
} else
if (lname.equals("double-space")) {
String existing = details.getProperty(SaxonOutputKeys.DOUBLE_SPACE);
if (existing == null) {
existing = "";
}
String s = parseListOfElementNames(value, nsResolver, prevalidated, checker, "XTDE0030");
details.setProperty(SaxonOutputKeys.SUPPRESS_INDENTATION, existing + s);
} else
if (lname.equals("next-in-chain")) {
XPathException e = new XPathException("saxon:next-in-chain value cannot be specified dynamically");
e.setErrorCode(NamespaceConstant.SAXON, SaxonErrorCode.SXWN9004);
throw e;
} else
if (lname.equals("require-well-formed")) {
if (prevalidated || value.equals("yes") || value.equals("no")) {
details.setProperty(SaxonOutputKeys.REQUIRE_WELL_FORMED, value);
} else {
XPathException e = new XPathException("saxon:require-well-formed value must be 'yes' or 'no'");
e.setErrorCode(NamespaceConstant.SAXON, SaxonErrorCode.SXWN9003);
throw e;
}
}
} else {