Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.instruct.Instruction
net.sf.saxon.instruct.CopyOf
public class CopyOf
extends Instruction
Field Summary |
Fields inherited from class net.sf.saxon.expr.Expression | |
EVALUATE_METHOD , ITERATE_METHOD , PROCESS_METHOD , locationId , staticProperties |
Constructor Summary | |
|
Method Summary | |
Expression |
|
boolean |
|
Item |
|
void |
|
int | |
int | |
int |
|
int |
|
ItemType | |
Expression |
|
int |
|
boolean |
|
boolean |
|
SequenceIterator |
|
Iterator | |
Expression |
|
TailCall |
|
protected void |
|
boolean |
|
void |
|
void |
|
void |
|
Expression |
|
Expression |
|
Methods inherited from class net.sf.saxon.instruct.Instruction | |
assembleParams , assembleTunnelParams , computeCardinality , computeSpecialProperties , createsNewNodes , dynamicError , evaluateAsString , evaluateItem , getImplementationMethod , getInstructionInfo , getInstructionNameCode , getItemType , getSourceLocator , isXSLT , iterate , process , processLeavingTail , promote , promoteInst , simplify |
public CopyOf(Expression select, boolean copyNamespaces, int validation, SchemaType schemaType, boolean rejectDuplicatAttributes)
Create an xsl:copy-of instruction (also used in XQuery for implicit copying)
- Parameters:
select
- expression that selects the nodes to be copiedcopyNamespaces
- true if namespaces are to be copiedvalidation
- validation mode for the result treeschemaType
- schema type for validating the result treerejectDuplicatAttributes
- true if duplicat attributes are to be rejected (XQuery). False if duplicates are handled by discarding all but the first (XSLT).
public Expression copy()
Copy an expression. This makes a deep copy.
- Overrides:
- copy in interface Expression
- Returns:
- the copy of the original expression
public final boolean createsNewNodes()
Determine whether this instruction creates new nodes. The result depends on the type of the select expression.
- Overrides:
- createsNewNodes in interface Instruction
public Item evaluateItem(XPathContext context) throws XPathException
Return the first item if there is one, or null if not
- Specified by:
- evaluateItem in interface EvaluableItem
- Overrides:
- evaluateItem in interface Instruction
- Parameters:
context
- the XPath dynamic context
- Returns:
- the result of evaluating the instruction
- Throws:
XPathException
-
public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
- Overrides:
- explain in interface Expression
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.
- Overrides:
- getImplementationMethod in interface Instruction
public int getInstructionNameCode()
Get the name of this instruction, for diagnostics and tracing
- Overrides:
- getInstructionNameCode in interface Instruction
public ItemType getItemType(TypeHierarchy th)
- Overrides:
- getItemType in interface Instruction
public Expression getSelectExpression()
Get the expression that selects the nodes to be copied
- Returns:
- the select expression
public int getValidationMode()
Get the validation mode
- Returns:
- the validation mode
public boolean isCopyNamespaces()
Determine whether namespaces are to be copied or not
- Returns:
- true if namespaces are to be copied (the default)
public boolean isDocumentOrElementRequired()
Test whether this expression requires a document or element node
- Returns:
- true if this expression requires the value of the argument to be a document or element node, false if there is no such requirement
public SequenceIterator iterate(XPathContext context) throws XPathException
- Specified by:
- iterate in interface SequenceIterable
- Overrides:
- iterate in interface Instruction
public Iterator iterateSubExpressions()
- Overrides:
- iterateSubExpressions in interface Expression
public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
- Overrides:
- optimize in interface Expression
public TailCall processLeavingTail(XPathContext context) throws XPathException
Process this xsl:copy-of instruction
- Specified by:
- processLeavingTail in interface TailCallReturner
- Overrides:
- processLeavingTail in interface Instruction
- Parameters:
context
- the dynamic context for the transformation
- Returns:
- null - this implementation of the method never returns a TailCall
protected void promoteInst(PromotionOffer offer) throws XPathException
- Overrides:
- promoteInst in interface Instruction
public boolean replaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression
- Overrides:
- replaceSubExpression in interface Expression
- Parameters:
original
- the original subexpressionreplacement
- the replacement subexpression
- Returns:
- true if the original subexpression is found
public void setCopyLineNumbers(boolean copy)
Set whether line numbers are to be copied from the source to the result. Default is false.
- Parameters:
copy
- true if line numbers are to be copied
public void setReadOnce(boolean b)
Set the "saxon:read-once" optimization mode
- Parameters:
b
- true to enable the optimization
public void setRequireDocumentOrElement(boolean requireDocumentOrElement)
For XQuery, the operand (select) must be a single element or document node.
- Parameters:
requireDocumentOrElement
- true if the argument must be a single element or document node
public Expression simplify(ExpressionVisitor visitor) throws XPathException
- Overrides:
- simplify in interface Instruction
public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
- Overrides:
- typeCheck in interface Expression