net.sf.saxon.instruct
Class Copy

java.lang.Object
  extended by net.sf.saxon.expr.Expression
      extended by net.sf.saxon.instruct.Instruction
          extended by net.sf.saxon.instruct.ParentNodeConstructor
              extended by net.sf.saxon.instruct.ElementCreator
                  extended by net.sf.saxon.instruct.Copy
All Implemented Interfaces:
Serializable, SourceLocator, Container, EvaluableItem, SequenceIterable, TailCallReturner, InstructionInfoProvider

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.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, PrintStream out, Configuration config)
          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
 String getNewBaseURI(XPathContext context)
          Get the base URI of a copied element node (the base URI is retained in the new copy)
 TailCall processLeavingTail(XPathContext context)
          Evaluate the instruction to produce a new element node.
 Expression simplify(StaticContext env)
          Simplify an expression.
 
Methods inherited from class net.sf.saxon.instruct.ElementCreator
computeSpecialProperties, getImplementationMethod, isInheritNamespaces, isValidating, setValidationMode, suppressValidation
 
Methods inherited from class net.sf.saxon.instruct.ParentNodeConstructor
computeCardinality, createsNewNodes, getBaseURI, getCardinality, getContentExpression, getSchemaType, getValidationMode, isLazyConstruction, isNamespaceSensitive, iterateSubExpressions, optimize, replaceSubExpression, setBaseURI, setContentExpression, setLazyConstruction, setSchemaType, typeCheck
 
Methods inherited from class net.sf.saxon.instruct.Instruction
appendItem, evaluateAsString, getInstructionInfo, getSourceLocator, isXSLT, iterate, process, promote
 
Methods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, effectiveBooleanValue, getColumnNumber, getContainingProcedure, getDependencies, getExecutable, getHostLanguage, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, resetStaticProperties, setLocationId, setParentExpression, setParentExpression
 
Methods inherited from class java.lang.Object
equals, 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

simplify

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

Overrides:
simplify in class ParentNodeConstructor
Returns:
the simplified expression
Throws:
XPathException - if an error is discovered during expression rewriting

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.

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

getNewBaseURI

public String getNewBaseURI(XPathContext context)
Get the base URI of a copied element node (the base URI is retained in the new copy)

Specified by:
getNewBaseURI in class ElementCreator
Parameters:
context -
Returns:
the base URI

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 - The dynamic context of the transformation, giving access to the current node, the current variables, etc.
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 EvaluableItem
Overrides:
evaluateItem in class ElementCreator
Parameters:
context - The context in which the expression is to be evaluated
Returns:
the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
Throws:
XPathException - if any dynamic error occurs evaluating the expression

display

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

Specified by:
display in class Expression
Parameters:
level - indentation level for this expression
out -
config -


Copyright (C) Michael H. Kay. All rights reserved.