[xsl] XSLT and XML Schema

Subject: [xsl] XSLT and XML Schema
From: Garvin Riensche <g.riensche@xxxxxxx>
Date: Wed, 13 Jun 2007 16:50:41 +0200
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