[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] best way to generate form from xml+schema?


Subject: Re: [xsl] best way to generate form from xml+schema?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 16 Oct 2001 10:08:09 +0100

Hi Graham,

> The only other alternative I could think of was to replace all
> <xsl:apply-template>s with <xsl:call-template>s, and pass the
> node-set from the xsl file as a parameter to each template,
> stripping off the upper levels as I descend through the tree. But
> this doesn't seem in keeping with the spirit of xsl, quite apart
> from the problem that I couldn't handle the syntax!

You can pass parameters with xsl:apply-templates as well as with
xsl:call-template. In fact, I think this is the best approach - apply
templates to work down the schema tree, but as you work down the tree
pass in the particular element from the instance tree that's relevant
at that particular point in the schema. It's very much in keeping
with the spirit of XSLT :)

I constructed a solution for precisely this problem for Chapter 10 of
Professional XSL from Wrox Press. You could probably come up with
something simpler in your situation, if you don't have to worry about
include/import/redefine in your schema, and particularly if you don't
have to worry about choices in the model groups, but it might be worth
taking a look at for some ideas.

Cheers,

Jeni

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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords