xsl-list
[Top] [All Lists]

Re: [xsl] XPath 2.0 Best Practice: wrap the first node of every path expression within schema-element?

2008-03-27 05:44:00
Mukul Gandhi wrote:

  Hi

   For this case, some form of static error reporting is already
defined in the XPath 2.0 spec. Please see:

http://www.w3.org/TR/xpath20/#id-schema-element-test

<quote>
schema-element(ElementName)

If the ElementName specified in the SchemaElementTest is not found in
the in-scope element declarations, a static error is raised
[err:XPST0008].
</quote>

  That is not the same thing.  In the Roger's suggestion, you set up
the static type of a step in a path (for instance explicitely, via a
variable, or in the initial context if the path is in an XSLT template
rule with schema-element as pattern.)

  Knowing on the one hand the static type at one step, and on the other
hand the schema, the processor is able to deduce the possible steps
(according to the schema) for most of the following steps (depending on
the schema and the following steps themselves.)

  And in order to use schema-element, you must have a global element in
the schema.  For instance:

    <xs:element name="author" type="author.type"/>

    <xs:complexType name="author.type">
       <xs:sequence>
          <xs:element name="first-name" type="xs:string"/>
       </xs:sequence>
    </xs:complexType>

  How could you be sure the processor will check that 'first-name' is
not misspelled in the following expression:

    schema-element(author)/first-name

?

  Regards,

--drkm
























      
_____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Capacité de stockage illimitée pour vos emails. 
http://mail.yahoo.fr


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>