Class ResultDocument
- All Implemented Interfaces:
- ContextOriginator,- ExportAgent,- InstructionWithComplexContent,- ValidatingInstruction,- Locatable,- IdentityComparable,- Traceable
The xsl:result-document element takes an attribute href="filename". The filename will often contain parameters, e.g. {position()} to ensure that a different file is produced for each element instance.
There is a further attribute "format" which determines the format of the output file, it identifies the name of an xsl:output element containing the output format details. In addition, individual serialization properties may be specified as attributes. These are attribute value templates, so they may need to be computed at run-time.
- 
Field SummaryFields inherited from class net.sf.saxon.expr.ExpressionEFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
- 
Constructor SummaryConstructorsConstructorDescriptionResultDocument(Properties globalProperties, Properties localProperties, Expression href, Expression formatExpression, int validationAction, SchemaType schemaType, Map<StructuredQName, Expression> serializationAttributes, CharacterMapIndex characterMapIndex) Create a result-document instruction
- 
Method SummaryModifier and TypeMethodDescriptionaddToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet) Add a representation of this expression to a PathMap.static voidcheckAcceptableUri(XPathContext context, String uri) copy(RebindingMap rebindings) Copy an expression.voidDiagnostic print of expression structure.gatherOutputProperties(XPathContext context) Create a properties object that combines the serialization properties specified on the xsl:result-document itself with those specified in the referenced xsl:output declarationGet the subexpression that is used to evaluated the content, that is, the contained sequence constructorMake an elaborator for this expressiongetHref()intGet the name of this instruction for diagnostic and tracing purposes (the string "xsl:result-document")intDetermine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions.Get the item type of the items returned by evaluating this instructionGet the schema type chosen for validation; null if not definedGet the value of a serialization property if it is statically knownGet the (partial) name of a class that supports streaming of this kind of expressionintGet the validation mode for this instructionGet the validation optionsbooleanAsk if the instruction is to be asynchronousbooleanisMultiThreaded(Configuration config) Ask whether the expression is multithreaded (that is, whether its operands are evaluated in parallel)booleanstatic ReceivermakeReceiver(String hrefValue, String baseURI, XPathContext context, ResultDocumentResolver resolver, SerializationProperties params, boolean resolveAgainstStaticBase) operands()Get the immediate sub-expressions of this expression, with information about the relationship of each expression to its parent expression.optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Perform optimisation of an expression and its subexpressions.voidprocess(PushEvaluator content, XPathContext context) voidprocessInstruction(PushEvaluator content, XPathContext context) Evaluation method designed for calling from compiled bytecode.processLeft(XPathContext context) static voidprocessXslOutputElement(NodeInfo element, Properties props, XPathContext c) Construct a set of output properties from an xsl:output element supplied at run-timevoidsetAsynchronous(boolean async) voidsetContentExpression(Expression content) Set the expression that constructs the contentvoidsetFormatExpression(Expression formatExpression) voidsetHref(Expression href) voidsetSchemaType(SchemaType type) Set the schema type to be used for validationstatic voidsetSerializationProperty(Properties details, NamespaceUri uri, String lname, String value, NamespaceResolver nsResolver, boolean prevalidated, Configuration config) Validate a serialization property and add its value to a Properties collectionvoidsetUseStaticBaseUri(boolean staticBase) Set whether the instruction should resolve the href relative URI against the static base URI (rather than the dynamic base output URI)voidsetValidationAction(int mode, SchemaType schemaType) Set the validation mode for the new documentstatic voidtraceDestination(XPathContext context, Result result) typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Perform type checking of an expression and its subexpressions.Methods inherited from class net.sf.saxon.expr.instruct.InstructionalwaysCreatesNewNodes, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, evaluateAsString, evaluateItem, getExpressionName, getImplementationMethod, getNetCost, getSourceLocator, isInstruction, isXSLT, iterate, mayCreateNewNodes, process, someOperandCreatesNewNodesMethods inherited from class net.sf.saxon.expr.ExpressionadoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeHashCode, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, equals, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isLiftable, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, toShortString, toString, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocationMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.trace.TraceablegatherProperties
- 
Constructor Details- 
ResultDocumentpublic ResultDocument(Properties globalProperties, Properties localProperties, Expression href, Expression formatExpression, int validationAction, SchemaType schemaType, Map<StructuredQName, Expression> serializationAttributes, CharacterMapIndex characterMapIndex) Create a result-document instruction- Parameters:
- 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 Details- 
setContentExpressionSet the expression that constructs the content- Parameters:
- content- the expression defining the content of the result document
 
- 
setSchemaTypeSet the schema type to be used for validation- Parameters:
- type- the type to be used for validation. (For a document constructor, this is the required type of the document element)
 
- 
getSchemaTypeGet the schema type chosen for validation; null if not defined- Specified by:
- getSchemaTypein interface- ValidatingInstruction
- Returns:
- the type to be used for validation. (For a document constructor, this is the required type of the document element)
 
- 
isResolveAgainstStaticBasepublic boolean isResolveAgainstStaticBase()
- 
getValidationOptionsGet the validation options- Returns:
- the validation options for the content of the constructed node. May be null if no validation was requested.
 
- 
setValidationActionSet the validation mode for the new document- Parameters:
- mode- the validation mode, for example- Validation.STRICT
- schemaType- the required type (for validation by type). Null if not validating by type
 
- 
getValidationActionpublic int getValidationAction()Get the validation mode for this instruction- Specified by:
- getValidationActionin interface- ValidatingInstruction
- Returns:
- the validation mode, for example Validation.STRICTorValidation.PRESERVE
 
- 
getFormatExpression
- 
setUseStaticBaseUripublic 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)- Parameters:
- 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
 
- 
setAsynchronouspublic void setAsynchronous(boolean async) 
- 
isAsynchronouspublic boolean isAsynchronous()Ask if the instruction is to be asynchronous- Returns:
- true unless saxon:asynchronous="no" was specified (regardless of other options that might suppress asychronous operation)
 
- 
isMultiThreadedDescription copied from class:ExpressionAsk whether the expression is multithreaded (that is, whether its operands are evaluated in parallel)- Overrides:
- isMultiThreadedin class- Expression
- Parameters:
- config- the Saxon configuration
- Returns:
- true if execution will be multithreaded
 
- 
typeCheckpublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Description copied from class:ExpressionPerform 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. - Overrides:
- typeCheckin class- Expression
- Parameters:
- visitor- an expression visitor
- contextInfo- Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.
- Returns:
- the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
- Throws:
- XPathException- if an error is discovered during this phase (typically a type error)
 
- 
getIntrinsicDependenciespublic int getIntrinsicDependencies()Description copied from class:ExpressionDetermine 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".- Overrides:
- getIntrinsicDependenciesin class- Expression
- Returns:
- an integer containing bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
 
- 
optimizepublic Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Description copied from class:ExpressionPerform 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. - Overrides:
- optimizein class- Expression
- Parameters:
- 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
- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
- XPathException- if an error is discovered during this phase (typically a type error)
 
- 
copyCopy an expression. This makes a deep copy.- Specified by:
- copyin class- Expression
- Parameters:
- rebindings- variable bindings that need to be changed
- Returns:
- the copy of the original expression
 
- 
getInstructionNameCodepublic int getInstructionNameCode()Get the name of this instruction for diagnostic and tracing purposes (the string "xsl:result-document")- Overrides:
- getInstructionNameCodein class- Instruction
- Returns:
- a code identifying the instruction: typically but not always the fingerprint of a name in the XSLT namespace
 
- 
getItemTypeGet the item type of the items returned by evaluating this instruction- Overrides:
- getItemTypein class- Instruction
- Returns:
- the static item type of the instruction. This is empty: the result-document instruction returns nothing.
 
- 
operandsDescription copied from class:ExpressionGet 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:
- operandsin class- Instruction
- Returns:
- an iterator containing the sub-expressions of this expression
 
- 
addToPathMapAdd 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. - Overrides:
- addToPathMapin class- Expression
- Parameters:
- pathMap- the PathMap to which the expression should be added
- pathMapNodeSet- the PathMapNodeSet to which the paths embodied in this expression should be added
- Returns:
- 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.
 
- 
process- Throws:
- XPathException
 
- 
processInstructionEvaluation method designed for calling from compiled bytecode.- Parameters:
- content- The content expression. When called from bytecode, this will be the compiled version of the interpreted content expression
- context- dynamic evaluation context
- Throws:
- XPathException- if a dynamic error occurs
 
- 
processLeft- Throws:
- XPathException
 
- 
getCharacterMapIndex
- 
makeReceiverpublic static Receiver makeReceiver(String hrefValue, String baseURI, XPathContext context, ResultDocumentResolver resolver, SerializationProperties params, boolean resolveAgainstStaticBase) throws XPathException - Throws:
- XPathException
 
- 
traceDestination
- 
checkAcceptableUri- Throws:
- XPathException
 
- 
gatherOutputPropertiesCreate a properties object that combines the serialization properties specified on the xsl:result-document itself with those specified in the referenced xsl:output declaration- Parameters:
- context- The XPath evaluation context
- Returns:
- the assembled properties
- Throws:
- XPathException- if invalid properties are found
 
- 
getStaticSerializationPropertyGet the value of a serialization property if it is statically known- Parameters:
- name- the name of the serialization property
- Returns:
- the value of the serialization property if known statically; or null otherwise
 
- 
setSerializationPropertypublic static void setSerializationProperty(Properties details, NamespaceUri uri, String lname, String value, NamespaceResolver nsResolver, boolean prevalidated, Configuration config) throws XPathException Validate a serialization property and add its value to a Properties collection- Parameters:
- 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
- Throws:
- XPathException- if any serialization property has an invalid value
 
- 
exportDiagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
- exportin interface- ExportAgent
- Specified by:
- exportin class- Expression
- Parameters:
- out- the expression presenter used to display the structure
- Throws:
- XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
 
- 
processXslOutputElementpublic static void processXslOutputElement(NodeInfo element, Properties props, XPathContext c) throws XPathException Construct a set of output properties from an xsl:output element supplied at run-time- Parameters:
- 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
- Throws:
- XPathException- if a dynamic error occurs
 
- 
getStreamerNameGet the (partial) name of a class that supports streaming of this kind of expression- Overrides:
- getStreamerNamein class- Expression
- Returns:
- 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
 
- 
getHref
- 
setHref
- 
setFormatExpression
- 
getContentExpressionDescription copied from interface:InstructionWithComplexContentGet the subexpression that is used to evaluated the content, that is, the contained sequence constructor- Specified by:
- getContentExpressionin interface- InstructionWithComplexContent
- Returns:
- the expression that constructs the content
 
- 
getElaboratorMake an elaborator for this expression- Overrides:
- getElaboratorin class- Expression
- Returns:
- an appropriate Elaborator
 
 
-