#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Liverpool
    Posts
    2
    Rep Power
    0

    Transforming xml doc


    Hi
    I need to transform this xml doc:

    <Recordset>
    <row>
    <CustomerID>ALFKI</CustomerID>
    <CustomerName>Alfreds</CustomerName>
    </row>
    </Recordset>


    To the following:

    <rs:data>
    <z:row> CustomerID="ALFKI" CustomerName="Alfreds"/>
    </rs:data>

    Any ideas
  2. #2
  3. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    14
    I guess something like this would work(left out all the usual XSL definitions):
    Code:
    <xsl:template match="Recordset/row">
    
    <xsl:element name="data" namespace="rs">
        <xsl:element name="row" namespace="z">
            <xsl:attribute name="CustomerID">
                    <xsl:value-of-select="CustomerID">
            </xsl:attribute>
            <xsl:attribute name="CustomerName">
                    <xsl:value-of-select="CustomerName">
            </xsl:attribute>
        </xsl:element>
    </xsl:element>
    
    </xsl:template>
    Note: this is completely untested, but I hope you get the point.

    Also: take a look at the XSLT reference at zvon.org.
    All the info you need about XSLT can be found there.

    Edit: noted an error in the namespace definition.
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Liverpool
    Posts
    2
    Rep Power
    0

    Transform XML


    my only problem now is how to create this or implement it using VB6. Any ideas?

IMN logo majestic logo threadwatch logo seochat tools logo