| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.functions; |
| 9 |
|
| 10 |
import com.saxonica.functions.extfn.EXPathArchive.Archive; |
| 11 |
import com.saxonica.functions.extfn.EXPathBinary; |
| 12 |
import com.saxonica.functions.extfn.EXPathFile; |
| 13 |
import net.sf.saxon.expr.Expression; |
| 14 |
import net.sf.saxon.expr.SystemFunctionCall; |
| 15 |
import net.sf.saxon.expr.XPathContext; |
| 16 |
import net.sf.saxon.expr.parser.ExpressionVisitor; |
| 17 |
import net.sf.saxon.lib.Feature; |
| 18 |
import net.sf.saxon.lib.NamespaceConstant; |
| 19 |
import net.sf.saxon.om.Sequence; |
| 20 |
import net.sf.saxon.trans.XPathException; |
| 21 |
import net.sf.saxon.value.QNameValue; |
| 22 |
import net.sf.saxon.value.SequenceExtent; |
| 23 |
|
| 24 |
import java.util.ArrayList; |
| 25 |
import java.util.List; |
| 26 |
|
| 27 |
public class AvailableSystemProperties extends SystemFunction { |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public Sequence<?> call(XPathContext context, Sequence[] arguments) throws XPathException { |
| 39 |
List<QNameValue> myList = new ArrayList<>(); |
| 40 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "version")); |
| 41 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "vendor")); |
| 42 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "vendor-url")); |
| 43 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "product-name")); |
| 44 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "product-version")); |
| 45 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "is-schema-aware")); |
| 46 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "supports-serialization")); |
| 47 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "supports-backwards-compatibility")); |
| 48 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "supports-namespace-axis")); |
| 49 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "supports-streaming")); |
| 50 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "supports-dynamic-evaluation")); |
| 51 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "supports-higher-order-functions")); |
| 52 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "xpath-version")); |
| 53 |
myList.add(new QNameValue("xsl", NamespaceConstant.XSLT, "xsd-version")); |
| 54 |
|
| 55 |
myList.add(new QNameValue("bin", EXPathBinary.NAMESPACE, "version")); |
| 56 |
myList.add(new QNameValue("file", EXPathFile.NAMESPACE, "version")); |
| 57 |
myList.add(new QNameValue("archive", Archive.NAMESPACE, "version")); |
| 58 |
|
| 59 |
|
| 60 |
if (context.getConfiguration().getBooleanProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS)) { |
| 61 |
for (Object s : System.getProperties().keySet()) { |
| 62 |
myList.add(new QNameValue("", "", s.toString())); |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
return SequenceExtent.makeSequenceExtent(myList); |
| 67 |
|
| 68 |
} |
| 69 |
|
| 70 |
@Override |
| 71 |
public Expression makeFunctionCall(Expression[] arguments) { |
| 72 |
return new SystemFunctionCall(this, arguments) { |
| 73 |
|
| 74 |
public Expression preEvaluate(ExpressionVisitor visitor) { |
| 75 |
return this; |
| 76 |
} |
| 77 |
}; |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
|