
Hi, schematron support in lxml is currently a second-class citizen due to libxml2 restrictions, see e.g. http://mail.gnome.org/archives/xml/2007-August/msg00016.html where Stefan commented on error reporting deficiencies or http://mail.gnome.org/archives/xml/2009-September/msg00022.html where Daniel of libxml2 fame comments on a feature request to support schematron embedded in XML Schema, basically stating that the implementation is incomplete. However, there is a pure-XSLT implementation of the now-ISO-standardized schematron by its inventor (and editor of the standard) Rick Jelliffe, the so-called skeleton implementation: http://www.schematron.com/ (Daniel also mentions this in his comment) Basically, the "skeleton" toolchain creates an xslt that is used for validation. Indeed, schematron itself is just a well-defined way of using xslt for validation, which I was looking into but really wasn't aware that schematron does this exactly. The "skeleton" implementation is available in both xslt 1 and 2 notions. The toolchain steps are (taken from www.schematron.com, modifications by me) 0) [Extract from XML Schema/RelaxNG schema)] 1) Process inclusions 2) Process abstract patterns 3) Compile the schema 4) Validate which translates to xsltproc XSD2Schtrn.xsl XMLSchema.xsd > theSchema.sch or xsltproc RNG2Schtrn.xsl RelaxNGSchema.rng > theSchema.sch xsltproc iso_dsdl_include.xsl theSchema.sch > theSchema1.sch xsltproc iso_abstract_expand.xsl theSchema1.sch > theSchema2.sch xsltproc iso_svrl_for_xsltn.xsl theSchema2.sch > theSchema.xsl xsltproc theSchema.xsl myDocument.xml > myResult.xml Enter libxslt aka lxml's xslt capabilities: It looks pretty easy to integrate this xslt-based toolchain into lxml, effectively enabling full ISO schematron support. I suggest complementing the current lxml schematron support using this approach: - add the necessary stylesheets (extraction and skeleton implementation) to the lxml codebase - add a convenient API to support xslt-based schematron validation to lxml that - hides toolchain steps, at least in default mode - fits in with the current validators' API - provides support for the parameters used for the separate toolchain steps And finally: Maybe somebody has already done this with lxml + schematron. Care to step forward? Any Comments? Holger -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser