Subject: Re: [xsl] Unique Nodes From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Thu, 29 Mar 2007 09:42:04 +0530 |
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/"> <Proposal> <Products> <xsl:for-each select="distinct-values(for $x in //ProdID return normalize-space($x))"> <ProdId><xsl:value-of select="." /></ProdId> </xsl:for-each> </Products> </Proposal> </xsl:template>
Hi , I am new to XSLT. I have to grab the unique Products from the Input below
INPUT:
<Proposal> <Quote> <QuoteId>1</QuoteId> <Products> <Product> <ProdID> 1234 </ProdID> <ProdID> 5678 </ProdID> </Product> </Products> </Quote> <Quote> <QuoteId>2</QuoteId> <Products> <Product> <ProdID> 1234 </ProdID> <ProdID> 5678 </ProdID> </Product> </Products> </Quote> </Proposal>
Desired OUTPUT:
<Proposal> <Products> <ProdId>1234</ProdId> <ProdId>5678</ProdId> </Products> </Proposal>
The code which I am trying is
<xsl:variable name="unique-Product" select="//Proposal/Quote/Products/Product[not(ProductId=ancestor::Product/ProductId)]"/>
<xsl:for-each select="$unique-Product"> </xsl:for-each>
Any help is appreciated
Thanks in advance Karthik
-- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Unique Nodes, Karthik | Thread | [xsl] Unique Nodes, Karthik |
Re: [xsl] Xpath 1.0 Question : Excl, Abel Braaksma | Date | RE: [xsl] Xpath 1.0 Question : Excl, Simon Shutter |
Month |