net.sf.saxon.instruct
Class Copy

java.lang.Object
  extended bynet.sf.saxon.expr.ComputedExpression
      extended bynet.sf.saxon.instruct.Instruction
          extended bynet.sf.saxon.instruct.ParentNodeConstructor
              extended bynet.sf.saxon.instruct.ElementCreator
                  extended bynet.sf.saxon.instruct.Copy
All Implemented Interfaces:
Container, Expression, InstructionInfoProvider, java.io.Serializable, javax.xml.transform.SourceLocator, TailCallReturner

public class Copy
extends ElementCreator

Handler for xsl:copy elements in stylesheet.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.instruct.ElementCreator
inheritNamespaces
 
Fields inherited from class net.sf.saxon.instruct.ParentNodeConstructor
content
 
Fields inherited from class net.sf.saxon.expr.ComputedExpression
locationId, staticProperties
 
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
 
Constructor Summary
Copy(boolean copyNamespaces, boolean inheritNamespaces, SchemaType schemaType, int validation)
           
 
Method Summary
 void display(int level, NamePool pool, java.io.PrintStream out)
          Diagnostic print of expression structure.
 Item evaluateItem(XPathContext context)
          Evaluate as an expression.
 int[] getActiveNamespaces()
          Callback to get a list of the intrinsic namespaces that need to be generated for the element.
 int getInstructionNameCode()
          Get the name of this instruction for diagnostic and tracing purposes
 ItemType getItemType(TypeHierarchy th)
          Get the item type of the result of this instruction.
 int getNameCode(XPathContext context)
          Callback from ElementCreator when constructing an element
protected  void outputNamespaceNodes(XPathContext context, Receiver receiver)
          Callback to output namespace nodes for the new element.
 TailCall processLeavingTail(XPathContext context)
          Evaluate the instruction to produce a new element node.
 
Methods inherited from class net.sf.saxon.instruct.ElementCreator
computeSpecialProperties, getImplementationMethod, getValidationMode, setValidationMode, suppressValidation
 
Methods inherited from class net.sf.saxon.instruct.ParentNodeConstructor
createsNewNodes, getCardinality, getContentExpression, getSchemaType, getValidationAction, isLazyConstruction, isNamespaceSensitive, iterateSubExpressions, optimize, promoteInst, setContentExpression, setLazyConstruction, setSchemaType, simplify, typeCheck
 
Methods inherited from class net.sf.saxon.instruct.Instruction
appendItem, assembleParams, assembleTunnelParams, computeCardinality, dynamicError, evaluateAsString, getInstructionInfo, getSourceLocator, isXSLT, iterate, process, promote
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, dynamicError, effectiveBooleanValue, getColumnNumber, getConstructType, getDependencies, getExecutable, getHostLanguage, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, resetStaticProperties, setLocationId, setParentExpression, typeError, typeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.xml.transform.SourceLocator
getColumnNumber, getLineNumber, getPublicId, getSystemId
 

Constructor Detail

Copy

public Copy(boolean copyNamespaces,
            boolean inheritNamespaces,
            SchemaType schemaType,
            int validation)
Method Detail

getInstructionNameCode

public int getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes

Overrides:
getInstructionNameCode in class Instruction

getItemType

public ItemType getItemType(TypeHierarchy th)
Get the item type of the result of this instruction.

Specified by:
getItemType in interface Expression
Overrides:
getItemType in class ElementCreator
Parameters:
th -
Returns:
The context item type.

getNameCode

public int getNameCode(XPathContext context)
                throws XPathException
Callback from ElementCreator when constructing an element

Specified by:
getNameCode in class ElementCreator
Parameters:
context -
Returns:
the namecode of the element to be constructed
Throws:
XPathException

outputNamespaceNodes

protected void outputNamespaceNodes(XPathContext context,
                                    Receiver receiver)
                             throws XPathException
Callback to output namespace nodes for the new element.

Specified by:
outputNamespaceNodes in class ElementCreator
Parameters:
context - The execution context
receiver - the Receiver where the namespace nodes are to be written
Throws:
XPathException

getActiveNamespaces

public int[] getActiveNamespaces()
                          throws XPathException
Callback to get a list of the intrinsic namespaces that need to be generated for the element. The result is an array of namespace codes, the codes either occupy the whole array or are terminated by a -1 entry. A result of null is equivalent to a zero-length array.

Overrides:
getActiveNamespaces in class ElementCreator
Throws:
XPathException

processLeavingTail

public TailCall processLeavingTail(XPathContext context)
                            throws XPathException
Description copied from class: ElementCreator
Evaluate the instruction to produce a new element node. This method is typically used when there is a parent element or document in a result tree, to which the new element is added.

Specified by:
processLeavingTail in interface TailCallReturner
Overrides:
processLeavingTail in class ElementCreator
Parameters:
context -
Returns:
null (this instruction never returns a tail call)
Throws:
XPathException

evaluateItem

public Item evaluateItem(XPathContext context)
                  throws XPathException
Evaluate as an expression. We rely on the fact that when these instructions are generated by XQuery, there will always be a valueExpression to evaluate the content

Specified by:
evaluateItem in interface Expression
Overrides:
evaluateItem in class ElementCreator
Throws:
XPathException

display

public void display(int level,
                    NamePool pool,
                    java.io.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 -
pool - NamePool used to expand any names appearing in the expression