Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - split parts list into groups >Thread Next - Re: split parts list into groups Re: split parts list into groupsTo: NULL Date: 6/1/2006 10:41:00 AM ljb wrote: > I have an XML parts list in ascending numeric order. I need to convert this > into a single HTML with multiple UL elements such that parts 0 through 100 > are placed into the first UL, 101 through 249 into the second and so on. How > is the best way to do this? Would I create a template for each group and > have them applied based on the part number? How do I create a template that > matches a range of node values rather than just match node names? > > thanks > LJB > > XML is similar to the following: > <Parts> > <Part><Number>15</Number><Description>aaa<Description></Part> > <Part><Number>98</Number><Description>bbb<Description></Part> > <Part><Number>105</Number><Description>ccc<Description></Part> > <Part><Number>107</Number><Description>ddd<Description></Part> > <Part><Number>249</Number><Description>eee<Description></Part> > <Part><Number>250</Number><Description>fff<Description></Part> > <Part><Number>251</Number><Description>ggg<Description></Part> > </Parts> > > Something like this perhaps: <xsl:template match="Parts"> <ul> <xsl:apply-templates select="Part[100 >= Number]"/> </ul> <ul> <xsl:apply-templates select="Part[Number > 100][249 >= Number]"/> </ul> <ul> <xsl:apply-templates select="Part[Number > 249]"/> </ul> </xsl:template> <xsl:template match="Part"> <li><xsl:value-of select="Description"/></li> </xsl:template> | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
