Hi Paul,
The appropriate way to do this is to use the apply-templates method, so
you have something like:
<xsl:for-each
select="Orders_Envelope/body/Orders/OrderLines/OrderLineDetail">
<tr>
<xsl:apply-templates select="Product/Description"/>
</tr>
</xsl:for each>
<xsl:template match="Description">
<td><xsl:value-of select="."/></td>
</xsl:template>
Without seeing your source XML it's difficult to say exactly, but you
rarely need to use the for-each construct, as the template will be called
for every node that matches the select= statement.
Cheers,
Jason
[quoted text, click to view] On Thu, 26 Aug 2004 15:50:41 +0100, Paul King wrote:
> Hi there,
>
> I have a raw XML order file with the following structure
>
> <root>
> <header>
> <body>
>
> Ok the HEADER contains details about the XML msg and its originator etc -
> pretty pointless stuff
> The BODY however contains multiple Orders with descriptions and QTY's etc.
>
> I have such designed an XSL basic sheet which allows me to fetch XML data
> into a table using the FOR-EACH routine.
>
> For example here is a little snippet:
>
> <xsl:for-each
> select="Orders_Envelope/body/Orders/OrderLines/OrderLineDetail">
> <tr>
> <td><xsl:value-of select="Product/Description"/></td>
> </tr>
> </xsl:for each>
>
> The resulting page only however fetches back the first product description
> from the file not others. Why is this?
>
> Any help would be great
Thanks guys - I think its just my inexperience with this technology
I think I have got it covered.
Cheers
Paul.
[quoted text, click to view] "Jason Sobell" <jason@nospamplease.org> wrote in message
news:1xh9em3f6v8or.91bklijqc280$.dlg@40tude.net...
> Hi Paul,
> The appropriate way to do this is to use the apply-templates method, so
> you have something like:
>
> <xsl:for-each
> select="Orders_Envelope/body/Orders/OrderLines/OrderLineDetail">
> <tr>
> <xsl:apply-templates select="Product/Description"/>
> </tr>
> </xsl:for each>
>
> <xsl:template match="Description">
> <td><xsl:value-of select="."/></td>
> </xsl:template>
>
> Without seeing your source XML it's difficult to say exactly, but you
> rarely need to use the for-each construct, as the template will be called
> for every node that matches the select= statement.
>
> Cheers,
> Jason
>
> On Thu, 26 Aug 2004 15:50:41 +0100, Paul King wrote:
>
> > Hi there,
> >
> > I have a raw XML order file with the following structure
> >
> > <root>
> > <header>
> > <body>
> >
> > Ok the HEADER contains details about the XML msg and its originator
etc -
> > pretty pointless stuff
> > The BODY however contains multiple Orders with descriptions and QTY's
etc.
> >
> > I have such designed an XSL basic sheet which allows me to fetch XML
data
> > into a table using the FOR-EACH routine.
> >
> > For example here is a little snippet:
> >
> > <xsl:for-each
> > select="Orders_Envelope/body/Orders/OrderLines/OrderLineDetail">
> > <tr>
> > <td><xsl:value-of select="Product/Description"/></td>
> > </tr>
> > </xsl:for each>
> >
> > The resulting page only however fetches back the first product
description
> > from the file not others. Why is this?
> >
> > Any help would be great
> > Paul