copy

The copy transfers a shallow copy (the node and any associated namespace node) of the current node to the output document. It does not copy any children or attributes of the current node.

Syntax
<copy> ::= "copy" ( "use-attribute-sets" <quote> <attribbute name list> <quote> )? "{" <block elements>+ "}"
Options
use-attribute-sets an optional string containing a whitelist separated list of other sets.
Elements

One or more block statements.

Examples

For example.

match using "node() | @*" priority "-1" scope "inline-text" { copy { apply-templates using "@*" apply-templates } }

compiles to

<template match="node() | @*" mode="inline-text" priority="-1"> <copy> <apply-templates select="@*"/> <apply-templates/> </copy> </template>

which will apply templates for the attributes and descendants of the current node (similar to copy-of).

Errors

Forgetting the open bracket.

stylesheet { version "1.0" match using "node() | @*" priority "-1" scope "inline-text" { copy apply-templates using "@*" apply-templates } } }

gives the error

**** (106) Unexpected symbol "apply-templates" in line 6 Check spelling, did you mean start of block bracket? **** (136) Unmatched brackets in 1 Too many close brackets?
Copyright 2024 Hugh Field-Richards. All Rights Reserved.