Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: split parts list into groups

From: Ivan Peters <ivan@--.----.--->
To: 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>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent