XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (150 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
12.92Mb size Format: txt, pdf, ePub
type
optional
Lexical QName
Identifies a type declaration (either a built-in type, or a user-defined type imported from a schema) against which copied nodes are to be validated

The
type
and
validation
attributes are mutually exclusive: if one is present, the other must be absent. These attributes are available only with a schema-aware processor.

Content

None; the element is always empty.

Effect

The result of evaluating the
select
expression can be any sequence, containing nodes, atomic values, or a mixture of the two. Each of the items is copied to the result sequence, as follows:

  • If the item is an atomic value, it is copied directly to the result sequence. So the instruction

    has exactly the same effect as the instruction

    .
  • If the item is a text node, comment, processing instruction, or namespace node, then it is copied in exactly the same way as with the

    instruction. The new node has the same name and string value as the original, but it has a new identity. For example,
    generate-id()
    applied to the new node will give a different result from
    generate-id()
    applied to the original.
  • If the item is an attribute node, then it is copied to create a new attribute node. The new attribute node has the same name and string value as the original, but has a new identity. The type annotation on the new attribute node depends on the values of the
    type
    and
    validation
    attributes. These work in the same way as for

    as described on page 254, except for the value
    validation=“preserve”
    , which causes the type annotation to be copied from the existing node.
  • If the item is an element node, then it is copied to create a new element node. This is a deep copy: All the attributes and children of the element node are also copied. The namespace nodes of this element, and of any descendant elements, are copied unless the
    copy-namespaces
    attribute is present with the value
    no
    . The base URIs of copied element nodes are unchanged (which means that any relative URIs in the content of these nodes retain their original meaning).
  • The type annotation of the new element node depends on the values of the
    type
    and
    validation
    attributes. If the
    type
    attribute is specified, or if
    validation
    is set to
    strip
    ,
    strict
    , or
    lax
    , then the effect is exactly as if new content were being constructed from scratch: Existing type annotations are discarded, and the copied content is revalidated to construct type annotations. In the case of
    validation=“preserve”
    , the existing type annotations are copied over to the new nodes.
  • If the item is a document node, then it is copied to create a new document node. This is a deep copy: All the children of the document node are also copied. All copied nodes below this document node retain the name, string value, base URIs, and type annotations of their respective originals. If
    validation=“preserve”
    is specified, then existing type annotations are copied unchanged; in other cases, document-level validation may occur to create new type annotations. This follows the rules for the

    instruction, which means that it includes checks on
    ID/IDREF
    constraints as well as

    ,

    , and

    .

Other books

Monster War by Dean Lorey
Man With a Squirrel by Nicholas Kilmer
Blood of the Maple by Dana Marie Bell
Cursed by the Sea God by Patrick Bowman
El mundo como supermercado by Michel Houellebecq