Converting XML to XSLT

V

Vince

Hi,

I've done a few searches and I can't seem to find a tool that will
translate XML into an XSLT document.

Is the only way to do it really by hand?

I have a large file and a tool would really speed things up. Any
suggestions?

Thank you.
 
P

Pavel Lepin

Vince said:
I've done a few searches and I can't seem to find a tool
that will translate XML into an XSLT document.

You're seriously confused. XSLT is a programming language
for expressing XML document transformations. I don't see
what you could possibly mean by "will translate XML into an
XSLT document".
 
V

Vince

You're seriously confused. XSLT is a programming language
for expressing XML document transformations. I don't see
what you could possibly mean by "will translate XML into an
XSLT document".

Programming language my as*

Your right, it transforms XML by replacing non static data. Whats so
hard to understand about conversion?
 
R

Richard Tobin

Your right, it transforms XML by replacing non static data. Whats so
hard to understand about conversion?

Like Pavel, I have no idea what you're talking about. "Converting XML to
XSLT" is like "converting ASCII to Fortran".

Perhaps you could give us an example of what you want to do?

-- Richard
 
S

Stanimir Stamenkov

Sun, 17 Feb 2008 21:58:49 -0800 (PST), /Vince/:
I've done a few searches and I can't seem to find a tool that will
translate XML into an XSLT document.

Is the only way to do it really by hand?

I have a large file and a tool would really speed things up. Any
suggestions?

You can do it by using another XSLT document containing the
necessary transformation instructions, then run it through an XSLT
processor and feed it with your XML data.
 
A

Andy Dingley

I've done a few searches and I can't seem to find a tool that will
translate XML into an XSLT document.

There are two ways to do this.

One is dead easy. So easy that we do it by hand, because it's not
worth writing a tool to do it for us. Just take the minimal XSLT
stylesheet that matches "/" and then paste your target XML document
inside the template element. You now have a valid XSLT stylesheet that
matches anything you feed it and generates your target XML document.
It's not agreat deal of use, but if what you want is something like
an existing XHTML example, then it can be a useful starting point to
save re-typing everything.

The second way carefully maps recognisable structures in the XML input
document to some abstract application-specific meta-structure, then to
map this meta-structure in turn onto the associated output content
units, with their necessary content. This is so fundamentally
difficult that it's an AI research project to do automatically, not
just some little downloadable script.
 
M

McSwell

Your right, it transforms XML by replacing non static data. Whats so
hard to understand about conversion?

What's so hard to understand is what it is you're trying to convert to
what. XSLT transforms already are XML, as stated in http://www.w3.org/TR/xslt:

"A transformation in the XSLT language is expressed as a well-formed
XML document..."

So there is no such thing as you asked for: "translate XML into an
XSLT document." You can however use XSLT code to translate an XML
document into some other format, whether it be another XML format (or
even an identical XML format), tab-delimited fields, or whatever.

Mike Maxwell
CASL/ U MD
 
J

Joseph Kesselman

Since we have a terminology problem, it might help to give a specific
(small!) example. What kind of XML are you starting with, and what do
you want the "conversion" to produce?

If you're trying to produce a stylesheet which will render that XML
document type for viewing by users... Yes, that has to be done by a
human, because someone has to decide what the rendered representation of
the document should be. It may be as simple as the XML source, or a tree
view thereof, or it may be a complex re-arrangement involving
selection/rejection of interesting portions, construction of indexes,
computations upon the data, etc. If you don't feel like dealing with
that, you might want to start with one of the XML-based languages like
Docbook which already has stylesheets written to render it.

If you're trying to produce a stylesheet that will do simple
impedence-matching from one XML structure to another... There have been
attempts to create "query by example" frameworks which let you
hand-construct the output you want for a given input and will then help
you match the two up against each other. The problem with this approach
is that it involves a certain amount of guesswork/mindreading on the
program's part, and/or human involvement to help clarify the intent, so
it isn't really clear that this is a lot easier than constructing the
stylesheet by hand. In some domains this approach works well, but the
fact that we don't hear much about it is some indication of how limited
those domains are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top