Converting XML to XSLT

Discussion in 'XML' started by Vince, Feb 18, 2008.

  1. Vince

    Vince Guest

    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.
    Vince, Feb 18, 2008
    #1
    1. Advertising

  2. Vince

    Pavel Lepin Guest

    Vince <> wrote in
    <>:
    > 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".

    --
    When all you have is a transformation engine, everything
    looks like a tree.
    Pavel Lepin, Feb 18, 2008
    #2
    1. Advertising

  3. Vince

    Vince Guest

    On Feb 18, 6:15 pm, Pavel Lepin <> wrote:
    > Vince <> wrote in
    > <>:
    >
    > > 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".
    >
    > --
    > When all you have is a transformation engine, everything
    > looks like a tree.


    Programming language my as*

    Your right, it transforms XML by replacing non static data. Whats so
    hard to understand about conversion?
    Vince, Feb 18, 2008
    #3
  4. In article <>,
    Vince <> wrote:
    >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
    --
    :wq
    Richard Tobin, Feb 18, 2008
    #4
  5. 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.

    --
    Stanimir
    Stanimir Stamenkov, Feb 19, 2008
    #5
  6. Vince

    Andy Dingley Guest

    On 18 Feb, 05:58, Vince <> wrote:

    > 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.
    Andy Dingley, Feb 19, 2008
    #6
  7. Vince

    McSwell Guest

    On Feb 18, 5:09 pm, Vince <> wrote:
    > 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
    McSwell, Feb 20, 2008
    #7
  8. 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.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, Feb 20, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    651
    Stylus Studio
    Aug 3, 2004
  2. nanookfan
    Replies:
    2
    Views:
    570
    Martin Honnen
    Jan 14, 2004
  3. H. Kaya
    Replies:
    1
    Views:
    490
    Soren Kuula
    Feb 13, 2004
  4. Replies:
    4
    Views:
    667
  5. jkflens
    Replies:
    2
    Views:
    1,459
    jkflens
    May 30, 2006
Loading...

Share This Page