net.sf.saxon.instruct

Class CopyOf

public class CopyOf extends Instruction implements MappingFunction

An xsl:copy-of element in the stylesheet.
Constructor Summary
CopyOf(Expression select, boolean copyNamespaces, int validation, SchemaType schemaType, boolean rejectDuplicatAttributes)
Method Summary
protected static voidcopyAttribute(NodeInfo source, SchemaType schemaType, int validation, Instruction instruction, XPathContext context, boolean rejectDuplicates)
booleancreatesNewNodes()
Determine whether this instruction creates new nodes.
voiddisplay(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure.
ItemevaluateItem(XPathContext context)
Return the first item if there is one, or null if not
intgetCardinality()
intgetDependencies()
intgetImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
intgetInstructionNameCode()
Get the name of this instruction, for diagnostics and tracing
ItemTypegetItemType(TypeHierarchy th)
SequenceIteratoriterate(XPathContext context)
IteratoriterateSubExpressions()
Objectmap(Item item, XPathContext context)
Map one item to a sequence.
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
TailCallprocessLeavingTail(XPathContext context)
Process this xsl:copy-of instruction
protected voidpromoteInst(PromotionOffer offer)
voidsetReadOnce(boolean b)
voidsetRequireDocumentOrElement(boolean requireDocumentOrElement)
For XQuery, the operand (select) must be a single element or document node.
Expressionsimplify(StaticContext env)
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)

Constructor Detail

CopyOf

public CopyOf(Expression select, boolean copyNamespaces, int validation, SchemaType schemaType, boolean rejectDuplicatAttributes)

Method Detail

copyAttribute

protected static void copyAttribute(NodeInfo source, SchemaType schemaType, int validation, Instruction instruction, XPathContext context, boolean rejectDuplicates)

createsNewNodes

public final boolean createsNewNodes()
Determine whether this instruction creates new nodes. The result depends on the type of the select expression.

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

evaluateItem

public Item evaluateItem(XPathContext context)
Return the first item if there is one, or null if not

Parameters: context

Returns: the result of evaluating the instruction

Throws: XPathException

getCardinality

public int getCardinality()

getDependencies

public int getDependencies()

getImplementationMethod

public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided. This implementation provides both iterate() and process() methods natively.

getInstructionNameCode

public int getInstructionNameCode()
Get the name of this instruction, for diagnostics and tracing

getItemType

public ItemType getItemType(TypeHierarchy th)

iterate

public SequenceIterator iterate(XPathContext context)

iterateSubExpressions

public Iterator iterateSubExpressions()

map

public Object map(Item item, XPathContext context)
Map one item to a sequence.

Parameters: item The item to be mapped. If context is supplied, this must be the same as context.currentItem(). context The processing context. This is supplied only for mapping constructs that set the context node, position, and size. Otherwise it is null.

Returns: either (a) a SequenceIterator over the sequence of items that the supplied input item maps to, or (b) an Item if it maps to a single item, or (c) null if it maps to an empty sequence.

optimize

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

processLeavingTail

public TailCall processLeavingTail(XPathContext context)
Process this xsl:copy-of instruction

Parameters: context the dynamic context for the transformation

Returns: null - this implementation of the method never returns a TailCall

promoteInst

protected void promoteInst(PromotionOffer offer)

setReadOnce

public void setReadOnce(boolean b)

setRequireDocumentOrElement

public void setRequireDocumentOrElement(boolean requireDocumentOrElement)
For XQuery, the operand (select) must be a single element or document node.

Parameters: requireDocumentOrElement

simplify

public Expression simplify(StaticContext env)

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)