W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2002

Re: Renaming elements???

From: Francis Norton <francis@redrice.com>
Date: Sun, 21 Apr 2002 19:36:23 +0100
Message-ID: <3CC306A7.4060103@redrice.com>
To: KPRESCOTT@NSPCC.org.uk
CC: xmlschema-dev@w3.org
Hi Kath,

KPRESCOTT@NSPCC.org.uk wrote:

>I've tried select Field1 ans Somethingelse1 but it doesn't like it
>
A SQL solution is a good idea, you could also create a view in SQL with 
field renaming, then query that.

>Is there a quick way to do this or do I have to treat the generated xml as a
>string and replace etc etc etc 
>
If you can't fix it in SQL then a fairly simple solution would be to use 
XSLT on the output - it should be supported by anything that's capable 
of supporting XML Schema.

Here's an example -

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">
    <!-- -->
    <!-- do a "pass-through" type transform  -->
    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>
    <!-- -->
    <!--  -->
    <xsl:template match="Field1">
        <xsl:element name="SomethingElse1">
            <xsl:apply-templates select="@* | node()"/>
        </xsl:element>
    </xsl:template>
    <!-- -->
</xsl:stylesheet>

Hope this helps -

Francis.
Received on Sunday, 21 April 2002 14:36:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT