RE: [xsl] XSLT and XML Schema

Subject: RE: [xsl] XSLT and XML Schema
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 13 Jun 2007 16:30:03 +0100
Well, in principle an XML Schema document is XML so you can use it as an
input to your stylesheet. But it's not easy to process unless you know the
coding standards that have been followed, because there are many different
ways of writing equivalent schemas. The next Saxon release will offer an
"predigested" XML representation of the schema component model that aims to
help with that.

Incidentally, attributes should be regarded as unordered: the concept of
"the third attribute" is not very meaningful.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Garvin Riensche [mailto:g.riensche@xxxxxxx] 
> Sent: 13 June 2007 15:51
> To: XSL-LIST
> Subject: [xsl] XSLT and XML Schema
> 
> Hi,
> 
> I am looking for tutorials about the use of XML Schema within 
> Stylesheets where the schema is used to get information about 
> the source document structure. I know how I can use XML 
> Schema for validation of a document or a part of it but what 
> I am looking for is how I can get information about the 
> source document structure from the schmema.
> 
> Let me post an example:
> 
> Suppose the following XML as input together with his 
> associated schema. 
> The parser will additionally get the parameter SrcName='A'
> 
> <class id="2" pkgid="1" classname="A">
> 	<field id="21" type="basic" typename="int" name="publ_int_i"/>
> 	<field id="22" type="basic" typename="long" name="long_d"/>
> 	<modifier modified_id="21" modifier="public"/> </class>
> 
> When creating the stylesheet (which should be created 
> dynamically later), I know that there is "class" Element with 
> 3 attributes but I don't know the name of the attributes. Is 
> it possible to get the names of the attributes from the 
> schema so that they can be used in a <xsl:match> element like
> 
> <xsl:match
> pattern="//class[*ask-schema-which-attribute-is-the-third-one(
> )=$SrcName*]>
> ?
> 
> Maybe this sounds confusing but what this all is about is a 
> comparison between so called "conditional transformations 
> (cts)", which are implemented in prolog and are used to 
> transform prolog facts, and xslt. 
> The prolog facts are translated to XML and I am trying to 
> translate these cts to xslt to see what is more powefull, cts or xslt.
> 
> Regards,
> Garvin

Current Thread