use xsl:element to output an "<xsl:template match=...> ?

Discussion in 'XML' started by Ray Tayek, Nov 30, 2003.

  1. Ray Tayek

    Ray Tayek Guest

    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:eek:utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/inputDocumentMap">
    <xsl:element name="xsl:template" match="/inputDocument">
    <xsl:apply-templates/>
    </xsl:element>
    </xsl:template>
    </xsl:stylesheet>

    but this is not going very well (the files are at:
    http://tayek.com/~ray/spy1/

    i want to create the sampleT1.xslt file (which will eat
    inputDocument.xml) from inputDocumentMap.xml. the sampleT1 works fine
    (at least in java, but xmlspy produces garbage). i want to create this
    file programmatically.

    i would assume that this (creating an xslt from an xslt and an xml)
    *can* be done but maybe it would be better to do it in java as i am a
    newbie to xslt (it's my first functional langauge). i have done this
    with a previous incarnation of the sampleT1.xslt, so it's not a problem,
    but it would be cool to do it in xslt.

    any pointers would be apreciated.

    thanks
    ---
    ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
    vice chair orange county java users group http://www.ocjug.org/
    hate spam? http://samspade.org/ssw/
     
    Ray Tayek, Nov 30, 2003
    #1
    1. Advertising

  2. Ray Tayek

    Ray Tayek Guest

    Ray Tayek wrote:
    > hi, trying to use an xslt to make an xslt. trying something like:
    >
    >...
    > <xsl:template match="/inputDocumentMap">
    > <xsl:element name="xsl:template" match="/inputDocument">
    > <xsl:apply-templates/>
    > </xsl:element>
    > </xsl:template>
    >


    this may be working a bit better:

    <?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:eek:utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/inputDocumentMap">
    <xsl:element name="xsl:template">
    <xsl:attribute name="match">/inputDocumentt</xsl:attribute>
    <!--xsl:attribute name="xml:space">preserve</xsl:attribute>-->
    <xsl:apply-templates/>
    </xsl:element>
    </xsl:template>
    </xsl:stylesheet>


    ---
    ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
    vice chair orange county java users group http://www.ocjug.org/
    hate spam? http://samspade.org/ssw/
     
    Ray Tayek, Nov 30, 2003
    #2
    1. Advertising

  3. Read also about the
    xsl:namespace-alias
    instruction.

    Using it to produce an xsl:stylesheet as the result of the transformation is
    more convenient than using xsl:element.

    Of course, it is also recommended to try another solution that solves your
    problem directly, without having to produce an intermediate stylesheet.

    =====
    Cheers,

    Dimitre Novatchev.
    http://fxsl.sourceforge.net/ -- the home of FXSL



    "Ray Tayek" <> wrote in message
    news:sXhyb.260314$9E1.1380781@attbi_s52...
    > Ray Tayek wrote:
    > > hi, trying to use an xslt to make an xslt. trying something like:
    > >
    > >...
    > > <xsl:template match="/inputDocumentMap">
    > > <xsl:element name="xsl:template" match="/inputDocument">
    > > <xsl:apply-templates/>
    > > </xsl:element>
    > > </xsl:template>
    > >

    >
    > this may be working a bit better:
    >
    > <?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:eek:utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    > <xsl:template match="/inputDocumentMap">
    > <xsl:element name="xsl:template">
    > <xsl:attribute name="match">/inputDocumentt</xsl:attribute>
    > <!--xsl:attribute name="xml:space">preserve</xsl:attribute>-->
    > <xsl:apply-templates/>
    > </xsl:element>
    > </xsl:template>
    > </xsl:stylesheet>
    >
    >
    > ---
    > ray tayek http://tayek.com/ actively seeking mentoring or telecommuting

    work
    > vice chair orange county java users group http://www.ocjug.org/
    > hate spam? http://samspade.org/ssw/
     
    Dimitre Novatchev, Nov 30, 2003
    #3
  4. Ray Tayek

    Ray Tayek Guest

    Dimitre Novatchev wrote:
    > Read also about the xsl:namespace-alias instruction.


    ok

    > Using it to produce an xsl:stylesheet as the result of the transformation is
    > more convenient than using xsl:element.
    >
    > Of course, it is also recommended to try another solution that solves your
    > problem directly, without having to produce an intermediate stylesheet.
    >


    that is a great idea, but i ahev no clue how to do it.

    i have a sample of the desired type of xslt that i want to produce
    called sampleT1.xsl at http://tayek.com/~ray/spy1/. it transforms the
    inputDocument.xml into what is needed. (the problem is to consume .csv's
    from excel that have notes with line breaks and ' and " and space
    charaters in the field names, so i have a csvparser that makes
    inputDocument.xml from the lusers' .csv).

    another input is the inputDocumentMap.xml which describes the processing
    that needs to be done on the inputDocument.xml file (this involves
    renaming fields, deleting fields, mapping data values of fields, and
    outputting records based on trigger fields in the input records).

    the idea is to let the user define the processing to be done on his csv
    file to get it into our xml/csv format, so this is done by a web app and
    i will get an inputDocumentMap.xml from this user interaction and then
    he can upload his .csv's so we can process them and stick 'em in our system.

    thanks

    >
    > "Ray Tayek" <> wrote in message
    > news:sXhyb.260314$9E1.1380781@attbi_s52...
    >
    >>Ray Tayek wrote:
    >>
    >>>hi, trying to use an xslt to make an xslt. trying something like:
    >>>

    ....
    >>>

    >>this may be working a bit better:
    >>
    >><?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:eek:utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    >><xsl:template match="/inputDocumentMap">
    >><xsl:element name="xsl:template">
    >><xsl:attribute name="match">/inputDocumentt</xsl:attribute>
    >><!--xsl:attribute name="xml:space">preserve</xsl:attribute>-->
    >><xsl:apply-templates/>
    >></xsl:element>
    >></xsl:template>
    >></xsl:stylesheet>

    ---
    ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
    vice chair orange county java users group http://www.ocjug.org/
    hate spam? http://samspade.org/ssw/
     
    Ray Tayek, Nov 30, 2003
    #4
    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. Replies:
    0
    Views:
    539
  2. David Cater
    Replies:
    6
    Views:
    1,787
    Pavel Lepin
    May 31, 2007
  3. HANM
    Replies:
    2
    Views:
    729
    Joseph Kesselman
    Jan 29, 2008
  4. Peng Yu
    Replies:
    3
    Views:
    784
    Thomas J. Gritzan
    Oct 26, 2008
  5. Replies:
    1
    Views:
    459
    Evans
    Mar 18, 2009
Loading...

Share This Page