Package net.sf.saxon.functions
Class DocumentFn
- java.lang.Object
-
- net.sf.saxon.functions.AbstractFunction
-
- net.sf.saxon.functions.SystemFunction
-
- net.sf.saxon.functions.DocumentFn
-
- All Implemented Interfaces:
Callable
,Function
,GroundedValue
,Item
,Sequence
public class DocumentFn extends SystemFunction implements Callable
Implements the XSLT document() function
-
-
Constructor Summary
Constructors Constructor Description DocumentFn()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Sequence
call(XPathContext context, Sequence[] arguments)
Evaluate the expressionstatic DocumentKey
computeDocumentKey(java.lang.String href, java.lang.String baseURI, PackageData packageData, javax.xml.transform.URIResolver resolver, boolean strip)
Compute a document key (an absolute URI that can be used to see if a document is already loaded)protected static DocumentKey
computeDocumentKey(java.lang.String href, java.lang.String baseURI, PackageData packageData, XPathContext c)
Compute a document keyint
getCardinality(Expression[] arguments)
Determine the static cardinalityint
getSpecialProperties(Expression[] arguments)
Get the static properties of this expression (other than its type).static NodeInfo
makeDoc(java.lang.String href, java.lang.String baseURI, PackageData packageData, ParseOptions options, XPathContext c, Location locator, boolean silent)
Supporting routine to load one external document given a URI (href) and a baseURI.Expression
makeFunctionCall(Expression... arguments)
Make an expression that either calls this function, or that is equivalent to a call on this functionstatic NodeInfo
preLoadDoc(java.lang.String href, java.lang.String baseURI, Configuration config, javax.xml.transform.SourceLocator locator)
Supporting routine to load one external document given a URI (href) and a baseURI.static javax.xml.transform.Source
resolveURI(java.lang.String href, java.lang.String baseURI, java.lang.String documentKey, XPathContext context)
Call the URIResolver to resolve a URIstatic void
sendDoc(java.lang.String href, java.lang.String baseURL, XPathContext c, Location locator, Receiver out, ParseOptions parseOptions)
Supporting routine to push one external document given a URI (href) and a baseURI to a given Receiver.-
Methods inherited from class net.sf.saxon.functions.SystemFunction
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getStaticBaseUriString, getStreamerName, importAttributes, isTrustedResultType, makeCall, makeFunction, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller
-
Methods inherited from class net.sf.saxon.functions.AbstractFunction
atomize, deepEquals, effectiveBooleanValue, getAnnotations, getStringValue, getStringValueCS, isArray, isMap, makeNewContext, simplify, typeCheck
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, head, isStreamed, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Method Detail
-
getCardinality
public int getCardinality(Expression[] arguments)
Determine the static cardinality- Overrides:
getCardinality
in classSystemFunction
- Parameters:
arguments
- the actual arguments supplied- Returns:
- the most precise available cardinality that the function will return
-
getSpecialProperties
public int getSpecialProperties(Expression[] arguments)
Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.- Overrides:
getSpecialProperties
in classSystemFunction
- Parameters:
arguments
- the expressions supplied as arguments to the function call
-
makeFunctionCall
public Expression makeFunctionCall(Expression... arguments)
Description copied from class:SystemFunction
Make an expression that either calls this function, or that is equivalent to a call on this function- Overrides:
makeFunctionCall
in classSystemFunction
- Parameters:
arguments
- the supplied arguments to the function call- Returns:
- either a function call on this function, or an expression that delivers the same result
-
call
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException
Evaluate the expression- Specified by:
call
in interfaceCallable
- Specified by:
call
in interfaceFunction
- Parameters:
context
- the dynamic evaluation contextarguments
- the values of the arguments, supplied as SequenceIterators- Returns:
- the result of the evaluation, in the form of a SequenceIterator
- Throws:
XPathException
- if a dynamic error occurs during the evaluation of the expression
-
makeDoc
public static NodeInfo makeDoc(java.lang.String href, java.lang.String baseURI, PackageData packageData, ParseOptions options, XPathContext c, Location locator, boolean silent) throws XPathException
Supporting routine to load one external document given a URI (href) and a baseURI. This is used in the normal case when a document is loaded at run-time (that is, when a Controller is available)- Parameters:
href
- the relative URIbaseURI
- the base URIpackageData
- the stylesheet (or other) package in which the call appearsoptions
- parse options to be used. May be null.c
- the dynamic XPath contextlocator
- used to identify the location of the instruction in event of errorsilent
- if true, errors should not be notified to the ErrorListener- Returns:
- the root of the constructed document, or the selected element within the document
if a fragment identifier was supplied, or null if the URIResolver returns an
instance of
EmptySource
; - Throws:
XPathException
- if reading or parsing the document fails
-
resolveURI
public static javax.xml.transform.Source resolveURI(java.lang.String href, java.lang.String baseURI, java.lang.String documentKey, XPathContext context) throws XPathException
Call the URIResolver to resolve a URI- Parameters:
href
- the supplied relative URI, stripped of any fragment identifierbaseURI
- the base URIdocumentKey
- the absolute URI if already available, or null otherwisecontext
- the dynamic context- Returns:
- a Source representing the document to be read
- Throws:
XPathException
- if the relative URI cannot be resolved
-
computeDocumentKey
protected static DocumentKey computeDocumentKey(java.lang.String href, java.lang.String baseURI, PackageData packageData, XPathContext c) throws XPathException
Compute a document key- Throws:
XPathException
-
computeDocumentKey
public static DocumentKey computeDocumentKey(java.lang.String href, java.lang.String baseURI, PackageData packageData, javax.xml.transform.URIResolver resolver, boolean strip)
Compute a document key (an absolute URI that can be used to see if a document is already loaded)- Parameters:
href
- the relative URIbaseURI
- the base URIpackageData
- the package in which the call to doc() or document() appears (affects options such as strip-space)resolver
- the URIResolverstrip
- true if the document is subject to whitespace stripping (typically a source document), false otherwise (typically a stylesheet module)
-
preLoadDoc
public static NodeInfo preLoadDoc(java.lang.String href, java.lang.String baseURI, Configuration config, javax.xml.transform.SourceLocator locator) throws XPathException
Supporting routine to load one external document given a URI (href) and a baseURI. This is used when the document is pre-loaded at compile time.- Parameters:
href
- the relative URI. This must not contain a fragment identifierbaseURI
- the base URIconfig
- the Saxon configurationlocator
- used to identify the location of the instruction in event of error. May be null.- Returns:
- the root of the constructed document, or the selected element within the document if a fragment identifier was supplied
- Throws:
XPathException
-
sendDoc
public static void sendDoc(java.lang.String href, java.lang.String baseURL, XPathContext c, Location locator, Receiver out, ParseOptions parseOptions) throws XPathException
Supporting routine to push one external document given a URI (href) and a baseURI to a given Receiver. This method cannot handle fragment identifiers- Parameters:
href
- the relative URIbaseURL
- the base URIc
- the XPath dynamic contextlocator
- used to identify the lcoation of the instruction in case of errorout
- the destination where the document is to be sent- Throws:
XPathException
-
-