Package net.sf.saxon.instruct
Class Copy
- All Implemented Interfaces:
Serializable
,SourceLocator
,Container
,Expression
,TailCallReturner
,InstructionInfoProvider
Handler for xsl:copy elements in stylesheet.
- See Also:
-
Field Summary
Fields inherited from class net.sf.saxon.instruct.ElementCreator
inheritNamespaces, validating
Fields inherited from class net.sf.saxon.instruct.ParentNodeConstructor
content, validation
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
ConstructorsConstructorDescriptionCopy
(boolean copyNamespaces, boolean inheritNamespaces, SchemaType schemaType, int validation) -
Method Summary
Modifier and TypeMethodDescriptionvoid
display
(int level, PrintStream out, Configuration config) Diagnostic print of expression structure.evaluateItem
(XPathContext context) Evaluate as an expression.int[]
Callback to get a list of the intrinsic namespaces that need to be generated for the element.int
Get the name of this instruction for diagnostic and tracing purposesGet the item type of the result of this instruction.int
getNameCode
(XPathContext context) Callback from ElementCreator when constructing an elementgetNewBaseURI
(XPathContext context) Get the base URI of a copied element node (the base URI is retained in the new copy)protected void
outputNamespaceNodes
(XPathContext context, Receiver receiver) Callback to output namespace nodes for the new element.processLeavingTail
(XPathContext context) Evaluate the instruction to produce a new element node.simplify
(StaticContext env) Simplify an expression.Methods inherited from class net.sf.saxon.instruct.ElementCreator
checkContentForAttributes, computeSpecialProperties, getImplementationMethod, getValidationMode, isInheritNamespaces, isValidating, setValidationMode, suppressValidation
Methods inherited from class net.sf.saxon.instruct.ParentNodeConstructor
createsNewNodes, getBaseURI, getCardinality, getContentExpression, getSchemaType, getValidationAction, isLazyConstruction, isNamespaceSensitive, iterateSubExpressions, optimize, promoteInst, replaceSubExpression, setBaseURI, setContentExpression, setLazyConstruction, setSchemaType, typeCheck, verifyLazyConstruction
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, effectiveBooleanValue, getColumnNumber, getConstructType, getDependencies, getExecutable, getHostLanguage, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, 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 Details
-
Copy
public Copy(boolean copyNamespaces, boolean inheritNamespaces, SchemaType schemaType, int validation)
-
-
Method Details
-
simplify
Simplify an expression. This performs any static optimization (by rewriting the expression as a different expression). The default implementation does nothing.- Specified by:
simplify
in interfaceExpression
- Overrides:
simplify
in classParentNodeConstructor
- Parameters:
env
- the static context- 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 classInstruction
-
getItemType
Get the item type of the result of this instruction.- Specified by:
getItemType
in interfaceExpression
- Overrides:
getItemType
in classElementCreator
- Parameters:
th
-- Returns:
- The context item type.
-
getNameCode
Callback from ElementCreator when constructing an element- Specified by:
getNameCode
in classElementCreator
- Parameters:
context
-- Returns:
- the namecode of the element to be constructed
- Throws:
XPathException
-
getNewBaseURI
Get the base URI of a copied element node (the base URI is retained in the new copy)- Specified by:
getNewBaseURI
in classElementCreator
- Parameters:
context
-- Returns:
- the base URI
-
outputNamespaceNodes
Callback to output namespace nodes for the new element.- Specified by:
outputNamespaceNodes
in classElementCreator
- Parameters:
context
- The execution contextreceiver
- the Receiver where the namespace nodes are to be written- Throws:
XPathException
-
getActiveNamespaces
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 classElementCreator
- Throws:
XPathException
-
processLeavingTail
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 interfaceTailCallReturner
- Overrides:
processLeavingTail
in classElementCreator
- Parameters:
context
-- Returns:
- null (this instruction never returns a tail call)
- Throws:
XPathException
-
evaluateItem
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 interfaceExpression
- Overrides:
evaluateItem
in classElementCreator
- 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
Diagnostic print of expression structure. The expression is written to the System.err output stream- Parameters:
level
- indentation level for this expressionout
-config
-
-