Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: preceding not working...can anybody help [Thread Next] Re: preceding not working...can anybody helpTo: NULL Date: 7/3/2006 8:27:00 AM <prateekbaxi@g...> wrote in message news:1151659069.676709.44770@p...... > Super....u r a genious....master of all in XPath and XSL.... > Umm.. thanks :) but there are chaps who post here who know way more than me. > u hv saved my day...mate... > > thanks a lot... > > Anthony Jones wrote: > > <prateekbaxi@g...> wrote in message > > news:1151594703.498062.159730@i...... > > > Hi, > > > > > > Thanks...yeah ur very correct...this approch is much faster then one I > > > was using...I m now goign to use the one suggested by you...can you > > > tell me what this approch is called... > > > > > > > Some refer to it as the Muenchian method. > > > > > one more...now i have to extend this XSL such that it can produce > > > follwing output > > > <Products> > > > <Product id="111" description="xx" price="33" expiry="sdf"> > > > <Services> > > > <Service id="1" description="TV" > > > longcommoditydescription="sdg" shortcommoditydescription ="sdfsdf"> > > > <Service id="2" description="TV" > > > longcommoditydescription="sdg" shortcommoditydescription ="sdfsdf"> > > > </Services> > > > </Product> > > > <Product id="141" description="xx" price="33" expiry="sdf"> > > > <Services> > > > <Service id="1" description="TV" > > > longcommoditydescription="sdg" shortcommoditydescription ="sdfsdf"> > > > <Service id="2" description="TV" > > > longcommoditydescription="sdg" shortcommoditydescription ="sdfsdf"> > > > </Services> > > > </Product> > > > <Product id="145" description="xx" price="33" expiry="sdf"> > > > <Services> > > > <Service id="1" description="TV" > > > longcommoditydescription="sdg" shortcommoditydescription ="sdfsdf"> > > > <Service id="2" description="TV" > > > longcommoditydescription="sdg" shortcommoditydescription ="sdfsdf"> > > > </Services> > > > </Product> > > > </Products> > > > > > > pls not data shown in above example is not matching the XML data. I > > > have done this as to give an example only in reality i am goign to use > > > the value hold by the xml element. > > > > > > Is this possible?? How? I want to generate <Service> for all the > > > element of Table1 but Product is not for unique id. Note that <service> > > > is under product > > > > > > > Not entirely sure I understand but does this do what you want:- > > > > <?xml version="1.0" encoding="UTF-8"?> > > <xsl:stylesheet version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> > > <xsl:key name="Products" match="Table1" use="ProductId" /> > > > > <xsl:template match="NewDataSet" name="productList"> > > <Products> > > <xsl:for-each select="Table1[count(key('Products', ProductId)[1] | .) > > =1]"> > > <Product id="{ProductId}" description="{ProductDescription}" > > price="{ProductPrice}" expiry="{ProductExpiry}"> > > <Services> > > <xsl:for-each select="key('Products',ProductId)"> > > <Service id="{ServiceId}" description="{ServiceDescription}" > > longcommoditydescription="{LongCommodityDesc}" > > shortcommoditydescription="{ShortCommodityDesc}" > > </xsl:for-each> > > </Services> > > </Product> > > </xsl:for-each> > > </Products> > > </xsl:template> > > </xsl:stylesheet> > > > > You might consider using shorter attribute names if this set to data is > > large. > > > > Anthony > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
