xsl-list
[Top] [All Lists]

RE: Static type-checker

2005-11-17 05:31:13
Michael Kay wrote:

If you want to check the XSLT stylesheet for static
errors without actually
executing it, try the command net.sf.saxon.Compile

  Mmh, yes.  But I want to check for static errors regarding *types*,
in all the XSLT script (not only in the template rules matching
schema-element()), in function of the schema.  Because net.sf.saxon is
not schema-aware, I presume net.sf.saxon.Compile does not the work.

  Saxon-SA does excatly what I want, but only in template rules
matching on schema-element() (if I understand correctly).  But I'd like
to make the same checks in all the XPath expressions in a given XSLT
script.  Example of already-implemented check in Saxon-SA: in schema:

    <xs:complexType name="list_type">
      <xs:sequence>
        <xs:element ref="my:elem" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
    <xs:element name="list" type="my:list_type"/>

In XSLT:

    <xsl:template match="schema-element(my:list)">
      <xsl:value-of select="my:elem[1]"/>
      <xsl:value-of select="my:zorglub[1]"/>
    </xsl:template>

Output of Saxon-SA 8.6:

    Warning: on line 13 of saxon-static-analysis.xsl:
      The complex type list_type does not allow a child
      element named zorglub

  Thanks for your help,

--drkm



















        

        
                
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com

--~------------------------------------------------------------------
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>
--~--