[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT 2.0 *and* XSLT 1.0 validation -- how to?

Subject: Re: XSLT 2.0 *and* XSLT 1.0 validation -- how to?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sun, 24 Oct 2004 11:03:02 +0100
novatchev tennison
Hi Dimitre,

> My question was, could there be a single schema that has both the
> rules for XSLT 1.0 and the rules for XSLT 2.0 and that, dependent on
> the value of the "version" attribute of an instance behaves exactly
> as an XSLT 1.0 schema only or exactly as an XSLT 2.0 schema only.
>
> I can imagine doing this with a pre-processor, which only reads and
> analyzes the xsl:stylesheet instruction, then depending on the
> version attribute it validates with only one of two schemas. Or, if
> rules in the schema can be based on a condition, it will set the
> condition to true or false and then validate with a single combined
> schema passing to it (e.g. setting this in DOM) the value of this
> condition.
>
> Can this be done?

The trouble is that XSLT allows regions of a stylesheet to belong to
different versions. In XSLT 1.0, you can put an xsl:version attribute
on any literal result element to indicate the version of XSLT used in
the content of that element. In XSLT 2.0, any XSLT element can have a
version attribute, and any other element can have a xsl:version
attribute that does the same thing.

So it's not as simple as looking at the version attribute on the
<xsl:stylesheet> element and choosing which version of the schema to
use based on that.

I think you could probably write a RELAX NG schema that used the
version switch correctly, wherever it was used (since RELAX NG
supports co-occurrence constraints, unlike XML Schema); I haven't
looked at Norm's, so I don't know whether his does that.

Personally, I don't think that it's worth validating XSLT stylesheets
against a schema. It's simpler, quicker, more accurate and more
helpful to get an XSLT processor to check your stylesheet instead.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.