RE: [xsl] Dividing a list of nodes into parts of the alphabet

Subject: RE: [xsl] Dividing a list of nodes into parts of the alphabet
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Fri, 3 Dec 2004 08:30:31 -0000
> I am working on a shop system for a friend of mine. This
> system shall parse one XML file into several static XHTML
> documents. As you may expect, there are several problems to
> manage. XHTML documents have to be created for each product,
> for each category and so on. Creating a page for each product
> in its categories directory - e.g.
> /catalogue/CDs/product_120.html - is easy using
> xsl:result-document since I make use of the latest version of
> Saxon and XSLT 2.0.
>
> But with the categories I ran into several logistic yet
> highly interesting problems:
> As you may imagine, the shop might have lots more
> CDs than, for example, Textiles, so I would like to add an
> opportunity to split the page created for each <group> into
> one or more pages, each including all artists beginning with
> the same letter or one letter out of a range of letters.
[snip]
> I think this is kind of tricky as I want to make the
> splitting option as variable as possibly. What I don't know
> is if I need a new attribute or child in <group/> with
> comma-separated letters/letter-groups and how I may interpret
> these. Or is it possible to interpret letters or
> letter-groups as xsl:sequence's in order to iterate through them?

Everything you have mentioned is perfectly possible - you can limit the
items per page by number or by initial, all configurable through
parameters or a different top-level stylesheet.  It's basic grouping, so
I would search read up on that first.

> I have been thinking about this for two hours now. Perhaps
> some of you do know a solution for it or at least are able to
> help in developing one.

2 hours! :) is that a long time to be thinking about a problem?

cheers
andrew

Current Thread