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 expression
    `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)
    `protected static DocumentKey` | `computeDocumentKey​(java.lang.String href, java.lang.String baseURI, PackageData packageData, XPathContext c)` | Compute a document key
    `int` | `getCardinality​(Expression[] arguments)` | Determine the static cardinality
    `int` | `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 function
    `static 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 URI
    `static 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.Function

      `getGenre`

    - ### 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`

- - ### Constructor Detail

    - #### DocumentFn

          public DocumentFn()

  - ### Method Detail

    - #### getCardinality

          public int getCardinality​(Expression[] arguments)

      Determine the static cardinality
      Overrides:
        `getCardinality` in class `SystemFunction`
      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 class `SystemFunction`
      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 class `SystemFunction`
      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 interface `Callable`
      Specified by:
        `call` in interface `Function`
      Parameters:
        `context` - the dynamic evaluation context
        `arguments` - 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 URI
        `baseURI` - the base URI
        `packageData` - the stylesheet (or other) package in which the call appears
        `options` - parse options to be used. May be null.
        `c` - the dynamic XPath context
        `locator` - used to identify the location of the instruction in event of error
        `silent` - 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 identifier
        `baseURI` - the base URI
        `documentKey` - the absolute URI if already available, or null otherwise
        `context` - 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 URI
        `baseURI` - the base URI
        `packageData` - the package in which the call to doc() or document() appears (affects options such as strip-space)
        `resolver` - the URIResolver
        `strip` - 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 identifier
        `baseURI` - the base URI
        `config` - the Saxon configuration
        `locator` - 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 URI
        `baseURL` - the base URI
        `c` - the XPath dynamic context
        `locator` - used to identify the lcoation of the instruction in case of error
        `out` - the destination where the document is to be sent
      Throws:
        `XPathException`