Class ResultDocument

    • Constructor Detail

      • ResultDocument

        public ResultDocument​(java.util.Properties globalProperties,
                              java.util.Properties localProperties,
                              Expression href,
                              Expression formatExpression,
                              int validationAction,
                              SchemaType schemaType,
                              java.util.Map<StructuredQName,​Expression> serializationAttributes,
                              CharacterMapIndex characterMapIndex)
        Create a result-document instruction
        globalProperties - properties defined on static xsl:output
        localProperties - non-AVT properties defined on result-document element
        href - href attribute of instruction
        formatExpression - format attribute of instruction
        validationAction - for example Validation.STRICT
        schemaType - schema type against which output is to be validated
        serializationAttributes - computed local properties
        characterMapIndex - index of named character maps
    • Method Detail

      • setContentExpression

        public void setContentExpression​(Expression content)
        Set the expression that constructs the content
        content - the expression defining the content of the result document
      • setSchemaType

        public void setSchemaType​(SchemaType type)
        Set the schema type to be used for validation
        type - the type to be used for validation. (For a document constructor, this is the required type of the document element)
      • getSchemaType

        public SchemaType getSchemaType()
        Get the schema type chosen for validation; null if not defined
        Specified by:
        getSchemaType in interface ValidatingInstruction
        the type to be used for validation. (For a document constructor, this is the required type of the document element)
      • isResolveAgainstStaticBase

        public boolean isResolveAgainstStaticBase()
      • getValidationOptions

        public ParseOptions getValidationOptions()
        Get the validation options
        the validation options for the content of the constructed node. May be null if no validation was requested.
      • setValidationAction

        public void setValidationAction​(int mode,
                                        SchemaType schemaType)
        Set the validation mode for the new document
        mode - the validation mode, for example Validation.STRICT
        schemaType - the required type (for validation by type). Null if not validating by type
      • getFormatExpression

        public Expression getFormatExpression()
      • setUseStaticBaseUri

        public void setUseStaticBaseUri​(boolean staticBase)
        Set whether the instruction should resolve the href relative URI against the static base URI (rather than the dynamic base output URI)
        staticBase - set to true by fn:put(), to resolve against the static base URI of the query. Default is false, which causes resolution against the base output URI obtained dynamically from the Controller
      • setAsynchronous

        public void setAsynchronous​(boolean async)
      • isAsynchronous

        public boolean isAsynchronous()
        Ask if the instruction is to be asynchronous
        true unless saxon:asynchronous="no" was specified (regardless of other options that might suppress asychronous operation)
      • isMultiThreaded

        public boolean isMultiThreaded​(Configuration config)
        Description copied from class: Expression
        Ask whether the expression is multithreaded (that is, whether its operands are evaluated in parallel)
        isMultiThreaded in class Expression
        config - the Saxon configuration
        true if execution will be multithreaded
      • typeCheck

        public Expression typeCheck​(ExpressionVisitor visitor,
                                    ContextItemStaticInfo contextInfo)
                             throws XPathException
        Description copied from class: Expression
        Perform type checking of an expression and its subexpressions. This is the second phase of static optimization.

        This checks statically that the operands of the expression have the correct type; if necessary it generates code to do run-time type checking or type conversion. A static type error is reported only if execution cannot possibly succeed, that is, if a run-time type error is inevitable. The call may return a modified form of the expression.

        This method is called after all references to functions and variables have been resolved to the declaration of the function or variable. However, the types of such functions and variables may not be accurately known if they have not been explicitly declared.

        typeCheck in class Expression
        visitor - an expression visitor
        contextInfo - Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.
        the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
        XPathException - if an error is discovered during this phase (typically a type error)
      • getIntrinsicDependencies

        public int getIntrinsicDependencies()
        Description copied from class: Expression
        Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. For example, position() has an intrinsic dependency on the context position, while (position()+1) does not. The default implementation of the method returns 0, indicating "no dependencies".
        getIntrinsicDependencies in class Expression
        an integer containing bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
      • optimize

        public Expression optimize​(ExpressionVisitor visitor,
                                   ContextItemStaticInfo contextInfo)
                            throws XPathException
        Description copied from class: Expression
        Perform optimisation of an expression and its subexpressions. This is the third and final phase of static optimization.

        This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

        optimize in class Expression
        visitor - an expression visitor
        contextInfo - the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to Type.ITEM_TYPE
        the original expression, rewritten if appropriate to optimize execution
        XPathException - if an error is discovered during this phase (typically a type error)
      • copy

        public Expression copy​(RebindingMap rebindings)
        Copy an expression. This makes a deep copy.
        Specified by:
        copy in class Expression
        rebindings - variable bindings that need to be changed
        the copy of the original expression
      • getInstructionNameCode

        public int getInstructionNameCode()
        Get the name of this instruction for diagnostic and tracing purposes (the string "xsl:result-document")
        getInstructionNameCode in class Instruction
        a code identifying the instruction: typically but not always the fingerprint of a name in the XSLT namespace
      • getItemType

        public ItemType getItemType()
        Get the item type of the items returned by evaluating this instruction
        getItemType in class Instruction
        the static item type of the instruction. This is empty: the result-document instruction returns nothing.
      • operands

        public java.lang.Iterable<Operand> operands()
        Description copied from class: Expression
        Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.

        If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.

        Specified by:
        operands in class Instruction
        an iterator containing the sub-expressions of this expression
      • addToPathMap

        public PathMap.PathMapNodeSet addToPathMap​(PathMap pathMap,
                                                   PathMap.PathMapNodeSet pathMapNodeSet)
        Add a representation of this expression to a PathMap. The PathMap captures a map of the nodes visited by an expression in a source tree.

        The default implementation of this method assumes that an expression does no navigation other than the navigation done by evaluating its subexpressions, and that the subexpressions are evaluated in the same context as the containing expression. The method must be overridden for any expression where these assumptions do not hold. For example, implementations exist for AxisExpression, ParentExpression, and RootExpression (because they perform navigation), and for the doc(), document(), and collection() functions because they create a new navigation root. Implementations also exist for PathExpression and FilterExpression because they have subexpressions that are evaluated in a different context from the calling expression.

        addToPathMap in class Expression
        pathMap - the PathMap to which the expression should be added
        pathMapNodeSet - the PathMapNodeSet to which the paths embodied in this expression should be added
        the pathMapNodeSet representing the points in the source document that are both reachable by this expression, and that represent possible results of this expression. For an expression that does navigation, it represents the end of the arc in the path map that describes the navigation route. For other expressions, it is the same as the input pathMapNode.
      • processInstruction

        public void processInstruction​(PushEvaluator content,
                                       XPathContext context)
                                throws XPathException
        Evaluation method designed for calling from compiled bytecode.
        content - The content expression. When called from bytecode, this will be the compiled version of the interpreted content expression
        context - dynamic evaluation context
        XPathException - if a dynamic error occurs
      • traceDestination

        public static void traceDestination​(XPathContext context,
                                            javax.xml.transform.Result result)
      • gatherOutputProperties

        public java.util.Properties gatherOutputProperties​(XPathContext context)
                                                    throws XPathException
        Create a properties object that combines the serialization properties specified on the xsl:result-document itself with those specified in the referenced xsl:output declaration
        context - The XPath evaluation context
        the assembled properties
        XPathException - if invalid properties are found
      • getStaticSerializationProperty

        public java.lang.String getStaticSerializationProperty​(StructuredQName name)
        Get the value of a serialization property if it is statically known
        name - the name of the serialization property
        the value of the serialization property if known statically; or null otherwise
      • setSerializationProperty

        public static void setSerializationProperty​(java.util.Properties details,
                                                    NamespaceUri uri,
                                                    java.lang.String lname,
                                                    java.lang.String value,
                                                    NamespaceResolver nsResolver,
                                                    boolean prevalidated,
                                                    Configuration config)
                                             throws XPathException
        Validate a serialization property and add its value to a Properties collection
        details - the properties to be updated
        uri - the uri of the property name
        lname - the local part of the property name
        value - the value of the serialization property. In the case of QName-valued values, this will use lexical QNames if prevalidated is false and a NamespaceResolver is supplied; otherwise they will use Clark-format names
        nsResolver - resolver for lexical QNames; not needed if prevalidated, or if QNames are supplied in Clark format
        prevalidated - true if values are already known to be valid and lexical QNames have been expanded into Clark notation
        config - the Saxon configuration
        XPathException - if any serialization property has an invalid value
      • export

        public void export​(ExpressionPresenter out)
                    throws XPathException
        Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
        Specified by:
        export in interface ExportAgent
        Specified by:
        export in class Expression
        out - the expression presenter used to display the structure
        XPathException - if the export fails, for example if an expression is found that won't work in the target environment.
      • processXslOutputElement

        public static void processXslOutputElement​(NodeInfo element,
                                                   java.util.Properties props,
                                                   XPathContext c)
                                            throws XPathException
        Construct a set of output properties from an xsl:output element supplied at run-time
        element - an xsl:output element
        props - Properties object to which will be added the values of those serialization properties that were specified
        c - the XPath dynamic context
        XPathException - if a dynamic error occurs
      • getStreamerName

        public java.lang.String getStreamerName()
        Get the (partial) name of a class that supports streaming of this kind of expression
        getStreamerName in class Expression
        the partial name of a class that can be instantiated to provide streaming support in Saxon-EE, or null if there is no such class
      • setHref

        public void setHref​(Expression href)
      • setFormatExpression

        public void setFormatExpression​(Expression formatExpression)