Subject: RE: List of Unique Items within an XML Document
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 22 Jun 2004 20:12:49 +0100
|
Sounds like a grouping problem: see
http://www.jenitennison.com/xslt/grouping for the standard approaches to
such problems.
Michael Kay
> -----Original Message-----
> From: Ben Gazzard [mailto:BenG@xxxxxxxxxxxxxx]
> Sent: 22 June 2004 15:53
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: List of Unique Items within an XML Document
>
> Hi All,
>
> Basically I have quite a flat XML Document that needs to be
> converted into a
> more structured one.
>
> ----Original XML----
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Import>
> <Row>
> <customer>ADULTS</customer>
> <product>SOCKS</product>
> <productID>611150</productID>
> <productName>COPA 3 STRIPE SOCK</productName>
> <productColor>WHITE/BLK</productColor>
> <productSize>2 | 3 | 4</productSize>
> </Row>
> </Import>
>
> ----Converted XML----
>
> <productCatalog>
> <product type="STRIPED SOCK">
> <productName>STRIPED SOCK</productName>
> <productType>SOCKS</productType>
> <productSpecs>manual</productSpecs>
> <productSize>
> <sizeAdult>2 | 3 | 4</sizeAdult>
> <sizeKid></sizeKid>
> </productSize>
> <productPrice>
> <priceAdult>manual</priceAdult>
> <priceKid>manual</priceKid>
> </productPrice>
> <!-- Repeat for each colour variation -->
> <productInfo id="1" type="STRIPED SOCK">
> <productCode>
> <codeAdult>2134124</codeAdult>
> <codeKid></codeKid>
> </productCode>
> <productColorScheme>
> <colourDecsription>WHITE/BLK</colourDecsription>
> <colourCode>manual</colourCode>
> <colourCode>manual</colourCode>
> </productColorScheme>
> </productInfo>
> </product>
> <productCatalog>
>
> The XSLT works fine so far. This Template triggers the other
> templates based
> on the product param.
>
> <xsl:template match="Import">
> <productCatalog>
> <xsl:call-template name="productTemplate">
> <xsl:with-param name="product" select="'COPA 3
> STRIPE SOCK'"/>
> </xsl:call-template>
> <!-- repeated for each product -->
> </productCatalog>
> </xsl:template>
>
> What I want to happen is that instead of manually putting
> each product name
> into a call-template param is for the xslt to do it itself.
> What is the best
> way to do this?
>
> Hope someone can help!
>
> Cheers,
> Ben
>
>
> This e-mail and any attached files are for the exclusive use
> of the addressee and may contain privileged and/or
> confidential information. If you receive this e-mail in error
> you should not disclose the contents to any other person nor
> take copies but should delete it and telephone us immediately
> on +44(0)20 7557 6100.
>
> TEQUILA\ London Limited does not make any warranty as to the
> accuracy or completeness of this e-mail and we accept no
> liability for its content or use. Any opinions expressed in
> this e-mail are those of the author and do not necessarily
> reflect the opinions of TEQUILA\ London Limited.
>
> TEQUILA\ London Limited operates within the parameters set by
> the Data Protection Act 1998 with regard to the use of
> personal information including e-mail addresses. We accept no
> liability for the forwarding of this e-mail to other parties
> that may result in unsolicited e-mails being received by
> those whose email addresses appear in this e-mail.
>
> --+------------------------------------------------------------------
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
>
>
|