
July 20th, 2005, 09:40 AM
| | | Tool that generates xsl:template tags from xsd?
I would like to know if there is a tool for download or purchase that
will generate a skeleton xslt document, inserting all the
xsl:template's matching each element specified in any given xsd.
Does anyone know of one?
Thanks,
KJ | 
July 20th, 2005, 09:40 AM
| | | Re: Tool that generates xsl:template tags from xsd?
This sort of thing can be done relatively easily with any of the
various
scripting languages that have XML libraries (python, perl, ruby). All
of which can be downloaded and installed on every major OS out there,
usually with no license fee. | 
July 20th, 2005, 09:40 AM
| | | Re: Tool that generates xsl:template tags from xsd?
KJ (n_o_s_p_a__m@mail.com) wrote:
: I would like to know if there is a tool for download or purchase that
: will generate a skeleton xslt document, inserting all the
: xsl:template's matching each element specified in any given xsd.
: Does anyone know of one?
No. But it doesn't sound difficult.
If you post a couple of simple xsd example files and the result you want,
then someone might give a few examples of how to do that based on those
examples.
(No promises.)
--
This space not for rent. | 
July 20th, 2005, 09:40 AM
| | | Re: Tool that generates xsl:template tags from xsd?
KJ wrote:
[color=blue]
>I would like to know if there is a tool for download or purchase that
>will generate a skeleton xslt document, inserting all the
>xsl:template's matching each element specified in any given xsd.
>
>Does anyone know of one?
>
>Thanks,
>KJ
>
>
>[/color]
Tell me more about what you want to use it for please.
I am writing a collection of schema-aware tools for XSL right now. I
might want to include that if it's really practically useful for somebody.
BTW, with local elements: If you have two locally declared element types
named "foo", do you want a template for each of them then?
Soren | 
July 20th, 2005, 09:40 AM
| | | Re: Tool that generates xsl:template tags from xsd?
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". | 
July 20th, 2005, 09:40 AM
| | | Re: Tool that generates xsl:template tags from xsd?
KJ wrote:
[color=blue]
>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".
>
>[/color]
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 |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|