[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] N input nodes to specific number of ouput nodes


Subject: RE: [xsl] N input nodes to specific number of ouput nodes
From: "Bordeman, Chris" <Chris.Bordeman@xxxxxxxxxxxxxxxxx>
Date: Wed, 22 Oct 2008 11:51:31 -0500

How?  The for-each loop works on the input set which never gets as high
as 10 if there aren't enough items in the input set.

-----Original Message-----
From: Colin Paul Adams [mailto:colin@xxxxxxxxxxxxxxxxxx]
Sent: Wednesday, October 22, 2008 10:44 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] N input nodes to specific number of ouput nodes

>>>>> "Chris" == Bordeman, Chris <Chris.Bordeman@xxxxxxxxxxxxxxxxx>
writes:

    Chris> Hi all.

    Chris> I need to loop through some nodes and output exactly 10
    Chris> output nodes, no matter how many input nodes there are.  If
    Chris> too few input nodes the ouput will just show "N/A" and if
    Chris> too many input nodes they will just be ignored.

    Chris> I can do the 'too many' with a for-each and a choose based
    Chris> on position() but don't get how the 'too few' scenario is
    Chris> handled.

An xsl:choose discriminating on count() should do the trick.
--
Colin Adams
Preston Lancashire


Current Thread