KJ said:
Well, here's the reason I asked. Since I'm in the habit of transforming
xml docs using the xsl:template paradigm (if it can be called that), it
would be nice if a program had a feature whereby I could provide the
program with any xsd, and the program would generate a xslt file with
(at least) an <xsl:template> for each element that would match all
instances of the xsd.
I tried Altova's StyleVision, which generates xslt from an xsd,
however, it relies heavily on the xsl:for-each "paradigm".
OK, so I take it is really mostly a matter of generating some empty code
skeletons...
Hey, you might actually make an xslt for that. There is some way (output
namespace aliasing or somthin', can't remember the details) to tell an
xsl processor "this (result tree fragment / sequence) is not an xsl
instruction for you, even though it's in the xsl namespace and really
looks like an xsl instruction". But of course xsd includes and imports
might be a bitch.
BTW, for-each can always be translated to template matching, unless on
the (pathological??) namespace axis. You can always do
<xsl:template match="pattern">
....
<xsl:for-each select="exp">
<t/>
</xsl:for-each>
....
</xsl:template>
to
<xsl:template match="pattern">
....
<xsl:apply-templates select="exp" mode="some_fresh_mode"/>
....
</xsl:template>
<xsl:template match="node()" mode="some_fresh_mode">
<t/>
</xsl:template>
(just FYI -- except for that namespace axis, there is nothing for-each
can do that templates can't do).
OK, I think it seems like a pretty simple task
One could easily hack
up something to make that, have a go at it
Soren