RE: [xsl] Malformed (??) XML and XML 2 SQL XSLT transformation

Subject: RE: [xsl] Malformed (??) XML and XML 2 SQL XSLT transformation
From: Guillaume LECERF <guillaume.lecerf@xxxxxxxxxxxxxx>
Date: Fri, 14 Nov 2003 16:46:17 +0100
Excuse me for being lame, but I'm rather new to XSL and I got an error with :

<xsl:template match="/"><xsl:apply-templates mode="columns"/><xsl:apply-templates mode="values"/></xsl:template>
<xsl:template match="Customer/Template/Fields">
<xsl:for-each select="item[position() mod group-size = 1]">
<xsl:template match="Orders" mode="columns">INSERT INTO orders(<xsl:for-each select="Customer/Template/Fields">"<xsl:value-of select="@FieldName" />"<xsl:if test="position() != last()">,</xsl:if></xsl:for-each>)</xsl:template>
<xsl:template match="Orders" mode="values"> values(<xsl:for-each select="Customer/Template/Fields">"<xsl:value-of select="FieldValue" />"<xsl:if test="position() != last()">,</xsl:if></xsl:for-each>);</xsl:template>
</xsl:for-each>
</xsl:template>


ERROR : Sablotron error on line 10: XSL element 'template' can only be used at the top level

:(

At 16:17 14/11/2003 +0100, you wrote:
> -----Original Message-----
> From: Guillaume LECERF
>
>
> Thanks for your answer, but my problem is that I need to generate TWO
> different insert instructions, each orders begginng with the <Fields
> FieldName="User Login ID"> tag.
>

So *that's* where my proposed solution differed from this one... and I had
just deleted it :)

In short:
Check http://www.dpawson.co.uk/xsl/sect2/N7450.html#d8136e352
to find out how to process every five elements as a group.

Then use this approach to add a for-each around the two <xsl:apply-templates
...> instructions in the root template of the stylesheet Charles posted.


Cheerz,


Andreas


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

--
Guillaume LECERF
Ingenieur Systemes d'Information / Responsable Production - Gage Interactive
http://www.activprint.com - +33 (0)2.31.06.67.62



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread