Re: Renaming elements???

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 UTC