473,513 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tool that generates xsl:template tags from xsd?

KJ
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

Jul 20 '05 #1
5 1431
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.

Jul 20 '05 #2
KJ (n_**********@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.
Jul 20 '05 #3
KJ 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?

Thanks,
KJ

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
Jul 20 '05 #4
KJ
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".

Jul 20 '05 #5
KJ wrote:
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
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1753
by: Kofi Sarfo | last post by:
Wondering what I'd use to evaluate the following to return 'Easy' <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="Answers.xsl"?> <answers> <answer>...
3
3197
by: Ray Tayek | last post by:
hi, trying to use an xslt to make an xslt. trying something like: <?xml version="1.0" encoding="UTF-8"?> <?xmlspysamplexml H:\java\projects\spy1\spy\inputDocumentMap.xml?> <xsl:stylesheet...
1
1411
by: Vijay singh | last post by:
Hi wonder if anybody can clear by doubt XML file : <score id="1"> <film>A Little Princess</film> <composer>Patrick Doyle</composer>
2
1868
by: Soren Kuula | last post by:
Hi, Suppose I have: <xsl:template match="foo"/> <xsl:template match="foo"/> -- is that an error (same priority)? (my precessor reports nothing, buts as far as I recall it doesn't really...
4
1803
by: dwa | last post by:
Is it legal to use a parameter in a <template match> ? If I do the following: <xsl:template match="/ContentRoot/Content/Categories/Category"> ....everything works as expected. But if I...
3
2259
by: Steve | last post by:
Is there any way of specifying the startMode when using the xslTransform class? We are updating code which used msxml to the system.xml classes but can find no way to specify the startMode. We...
2
1373
by: tentstitcher | last post by:
Hello: I am stumped on what I belive to be a namespace issue. The XSL, source XML, and result XML are included below. The problem is that the template to match "getBalances" is never invoked by...
2
1079
by: eric.goforth | last post by:
Hello, What happens if you call an xsl template if you call it without setting the values of all it's parameters, I assume that the parameters will be either null or an empty string and the...
4
1734
by: festo | last post by:
Hi guys, I need to print a different footer depending on the template being printed. How do I test for the current template being processed in XSLT? Thanks, fes
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.