Tool that generates xsl:template tags from xsd?

Discussion in 'XML' started by KJ, May 27, 2005.

  1. KJ

    KJ Guest

    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
     
    KJ, May 27, 2005
    #1
    1. Advertising

  2. KJ

    Guest

    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.
     
    , May 27, 2005
    #2
    1. Advertising

  3. KJ

    Soren Kuula Guest

    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
     
    Soren Kuula, May 27, 2005
    #3
  4. KJ

    KJ Guest

    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".
     
    KJ, May 27, 2005
    #4
  5. 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?

    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.
     
    Malcolm Dew-Jones, May 27, 2005
    #5
  6. KJ

    Soren Kuula Guest

    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
     
    Soren Kuula, May 27, 2005
    #6
    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. Greg Smith
    Replies:
    35
    Views:
    3,224
    Alex Kay
    Oct 24, 2004
  2. writeOnceDebugEverywhere()

    Open-source tool which generates Java Value objects ?

    writeOnceDebugEverywhere(), Mar 23, 2005, in forum: Java
    Replies:
    5
    Views:
    740
    frebe
    Mar 23, 2005
  3. Replies:
    1
    Views:
    3,692
    A. Bolmarcich
    May 27, 2005
  4. wickedbomb
    Replies:
    2
    Views:
    548
    wickedbomb
    Jul 14, 2005
  5. Replies:
    0
    Views:
    583
Loading...

Share This Page