Re: [xsl] Schema for Validating XSLT-Stylesheets

Subject: Re: [xsl] Schema for Validating XSLT-Stylesheets
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 11 Oct 2001 18:29:34 +0100
Hi Sebastian,

> Is there any XML-Schema conforming with the latest XML-Schema
> Specification (ideally 2001), we could use to validate the
> stylesheet? Or does anybody know another method to validate a
> stylesheet with Xerces (or Xalan)?

Searching for "XML Schema for XSLT" on Google produced the following
article, which contains a link to an XML Schema for XSLT

Usually running an XSLT stylesheet against any document (even itself)
using an XSLT processor (e.g. Xalan) will tell you if anything's
syntactically wrong with the stylesheet, which is all that a schema
will really be able to tell you anyway.
> Our special problem is that we want to validate an XML-Document, in
> which we have embedded some XSL-Tags. The parser cannot validate the
> whole document, if it cannot validate the XSL-part, can it?

This is really a schema question, but often it can. What you need to
do is to add an xs:import element to the schema to reference a
(non-existant) XSLT schema:

<xs:import namespace=""; />

Then, whenever there's somewhere that XSLT elements might go, you can
use the xs:any element to represent XSLT elements. Tell the schema
validator not to bother validating them by adding a processContents
attribute with a value of 'skip':

  <xs:any namespace="";
          processContents="skip" />

or if there are specific XSLT elements that need to be incorporated,
I *think* you can include references to them and because you haven't
actually provided a schema for them, it will skip over them:

  <xs:element ref="xsl:value-of" />

But you'd be better off asking about this on xmlschema-dev@xxxxxxx

I hope that helps,


Jeni Tennison

 XSL-List info and archive:

Current Thread