473,661 Members | 2,421 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 1447
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_**********@m ail.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_fres h_mode"/>
....
</xsl:template>

<xsl:template match="node()" mode="some_fres h_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
1760
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> <code>A</code> <method>Easy</method> </answer> <answer>
3
3207
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 version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/inputDocumentMap"> <xsl:element name="xsl:template" match="/inputDocument">...
1
1425
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
1873
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 have to). Or is the priority a post-predicate-survival issue?
4
1813
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 do the following: <xsl:template
3
2263
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 use this so that we can specify different templates to be used by the same xml node. Know that we could use global params, but would rather not have to update all teh stylesheets and any code that uses msxml and the same stylesheets.
2
1377
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 the apply-templates. If I remove the default namespace in the source XML's getBalance element, the problem goes away and the template is matched. I spent several hours searching the newsgroups but in vain. Any help would be appreciated.
2
1083
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 following code will handle it: <xsl:if test="string-length($sValue) &gt; 0"> <xsl:attribute name="VALUE"><xsl:value-of select="$sValue"/></xsl:attribute> </xsl:if>
4
1743
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
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.