net.sf.saxon.instruct

Class ResultDocument

public class ResultDocument extends Instruction

The compiled form of an xsl:result-document element in the stylesheet.

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.

Constructor Summary
ResultDocument(Properties globalProperties, Properties localProperties, Expression href, Expression formatExpression, String baseURI, int validationAction, SchemaType schemaType, IntHashMap serializationAttributes, NamespaceResolver nsResolver)
Method Summary
voiddisplay(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure.
intgetInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes (the string "xsl:result-document")
intgetIntrinsicDependencies()
ItemTypegetItemType(TypeHierarchy th)
Get the item type of the items returned by evaluating this instruction
IteratoriterateSubExpressions()
Get all the XPath expressions associated with this instruction (in XSLT terms, the expression present on attributes of the instruction, as distinct from the child instructions in a sequence construction)
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
TailCallprocessLeavingTail(XPathContext context)
protected voidpromoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.
voidsetContent(Expression content)
Set the expression that constructs the content
static voidsetSerializationProperty(Properties details, String uri, String lname, String value, NamespaceResolver nsResolver, boolean prevalidated, NameChecker checker)
Validate a serialization property and add its value to a Properties collection
Expressionsimplify(StaticContext env)
Simplify an expression.
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)

Constructor Detail

ResultDocument

public ResultDocument(Properties globalProperties, Properties localProperties, Expression href, Expression formatExpression, String baseURI, int validationAction, SchemaType schemaType, IntHashMap serializationAttributes, NamespaceResolver nsResolver)

Method Detail

display

public void display(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure. The expression is written to the System.err output stream

Parameters: level indentation level for this expression out

getInstructionNameCode

public int getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes (the string "xsl:result-document")

getIntrinsicDependencies

public int getIntrinsicDependencies()

getItemType

public ItemType getItemType(TypeHierarchy th)
Get the item type of the items returned by evaluating this instruction

Parameters: th

Returns: the static item type of the instruction. This is empty: the result-document instruction returns nothing.

iterateSubExpressions

public Iterator iterateSubExpressions()
Get all the XPath expressions associated with this instruction (in XSLT terms, the expression present on attributes of the instruction, as distinct from the child instructions in a sequence construction)

optimize

public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)

processLeavingTail

public TailCall processLeavingTail(XPathContext context)

promoteInst

protected void promoteInst(PromotionOffer offer)
Handle promotion offers, that is, non-local tree rewrites.

Parameters: offer The type of rewrite being offered

Throws: XPathException

setContent

public void setContent(Expression content)
Set the expression that constructs the content

setSerializationProperty

public static void setSerializationProperty(Properties details, String uri, String lname, String value, NamespaceResolver nsResolver, boolean prevalidated, NameChecker checker)
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, Clark-format names otherwise nsResolver resolver for lexical QNames; not needed if prevalidated prevalidated true if values are already known to be valid and lexical QNames have been expanded into Clark notation checker

simplify

public Expression simplify(StaticContext env)
Simplify an expression. This performs any static optimization (by rewriting the expression as a different expression). The default implementation does nothing.

Returns: the simplified expression

Throws: net.sf.saxon.trans.XPathException if an error is discovered during expression rewriting

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)