Name

<xsl:copy-of>

Creates a deep copy of a node.

Category

Instruction.

Required Attribute

select

Contains an XPath expression that defines the nodes to be copied to the output document.

Optional Attributes

[2.0] copy-namespaces

Defines whether namespaces should be copied. This applies only when copying an element node. Allowed values are yes (the default) and no.

[2.0 – Schema] type

Defines the datatype of the copied node. The datatype can be any of the built-in datatypes, or it can be a datatype defined in a schema if you have a schema-aware XSLT 2.0 processor.

The type and validation attributes are mutually exclusive.

[2.0 – Schema] validation

Defines how the value of the copied node will be validated. The validation attribute has four values: strict, lax, preserve, or strip.

validation="strict" means that the XSLT processor looks in all the declared schemas for a node declaration (<xs:attribute> or <xs:element>) with the same name as this node. It is a fatal error if the processor can’t find a matching declaration. Assuming the processor finds the declaration of the attribute or element node, it validates the generated value against its declaration in the schema.

validation="lax" works just like validation="strict", except that no error occurs if the processor can’t find the declaration of the node in any of the declared schemas. In that case, the type annotation of a copied attribute or element is xs:untypedAtomic or xs:untyped, respectively.

The value validation="preserve" means that all the ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.