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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
13.3Mb size Format: txt, pdf, ePub

Usage

It's not necessary to import every schema that has been used to validate an input document. You only need to import the schema if there is code in the stylesheet that actually references the names whose meaning is defined in the schema.

The places where such references may occur are as follows:

  • In the
    type
    attribute of

    ,

    ,

    ,

    ,

    ,

    , and the
    xsl:type
    attribute of literal result elements. This is always a
    QName
    identifying a top-level type definition, and unless it is one of the built-in types such as
    xs:integer
    , the schema in which the type is defined must be imported.
  • In the
    as
    attribute of

    ,

    ,

    ,

    , and

    . The value of this attribute is a description of an XPath type and is expressed using the
    SequenceType
    syntax defined in Chapter 11. If the
    SequenceType
    references the name of an atomic type, this will be a
    QName
    identifying either a built-in type such as
    xs:date
    , or a top-level simple type definition in a schema. If the latter is the case, the schema must be imported. If the
    SequenceType
    uses the constructs
    element(N, T)
    or
    attribute(N, T)
    then the rules are slightly more complicated, and are described below.
  • In an XPath expression anywhere in the stylesheet that uses a
    SequenceType
    . This construct is used in expressions such as
    $x instance of T
    or
    $x treat as T
    . The rules here are the same as for a
    SequenceType
    appearing in an
    as
    attribute, as described in the previous item.
  • In an XPath expression that uses a constructor function for a user-defined atomic type (for example
    mf:part-number(‘PXW5792’)
    ) or a cast to a user-defined atomic type (for example
    ’PXW5792’ cast as mf:part-number
    ). In both these cases, the type name must be the name of a top-level simple type definition, and the schema containing this type definition must be imported.

Other books

Very Deadly Yours by Carolyn Keene
Outside of a Dog by Rick Gekoski
Blood of the Underworld by David Dalglish
Chasing Me by Cat Mason
The Wrong Girl by Hank Phillippi Ryan
Ten Things I Hate About Me by Randa Abdel-Fattah