}
public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPathException {
StructuredQName propertyName = null;
XProcRuntime runtime = registry.getRuntime(xdef);
XStep step = runtime.getXProcData().getStep();
// FIXME: this can't be the best way to do this...
// FIXME: And what, exactly, is this even supposed to be doing!?
if (step != null && !(step instanceof XCompoundStep)) {
throw XProcException.dynamicError(23);
}
try {
String lexicalQName = sequences[0].head().getStringValue();
propertyName = StructuredQName.fromLexicalQName(
lexicalQName,
false,
false,
xPathContext.getConfiguration().getNameChecker(),
staticContext.getNamespaceResolver());
} catch (XPathException e) {
if (e.getErrorCodeLocalPart()==null || e.getErrorCodeLocalPart().equals("FOCA0002")
|| e.getErrorCodeLocalPart().equals("FONS0004")) {
e.setErrorCode("XTDE1390");
}
throw e;
}
String uri = propertyName.getURI();
String local = propertyName.getLocalPart();
String value = "";
if (uri.equals(XProcConstants.NS_XPROC)) {
if ("episode".equals(local)) {
value = runtime.getEpisode();
} else if ("language".equals(local)) {
value = runtime.getLanguage();
} else if ("product-name".equals(local)) {
value = runtime.getProductName();
} else if ("product-version".equals(local)) {
value = runtime.getProductVersion();
} else if ("vendor".equals(local)) {
value = runtime.getVendor();
} else if ("vendor-uri".equals(local)) {
value = runtime.getVendorURI();
} else if ("version".equals(local)) {
value = runtime.getXProcVersion();
} else if ("xpath-version".equals(local)) {
value = runtime.getXPathVersion();
} else if ("psvi-supported".equals(local)) {
value = runtime.getPSVISupported() ? "true" : "false";
}
} else if (uri.equals(XProcConstants.NS_CALABASH_EX)) {
if ("transparent-json".equals(local)) {
value = runtime.transparentJSON() ? "true" : "false";
} else if ("json-flavor".equals(local)) {
value = runtime.jsonFlavor();
} else if ("general-values".equals(local)) {
value = runtime.getAllowGeneralExpressions() ? "true" : "false";
} else if ("xpointer-on-text".equals(local)) {
value = runtime.getAllowXPointerOnText() ? "true" : "false";
} else if ("use-xslt-1.0".equals(local) || "use-xslt-10".equals(local)) {
value = runtime.getUseXslt10Processor() ? "true" : "false";
} else if ("html-serializer".equals(local)) {
value = runtime.getHtmlSerializer() ? "true" : "false";
} else if ("saxon-version".equals(local)) {
value = runtime.getConfiguration().getProcessor().getSaxonProductVersion();
} else if ("saxon-edition".equals(local)) {
value = runtime.getConfiguration().saxonProcessor;
}
}
return new StringValue(value);
}