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

[xsl] Easy question, big headache.


Subject: [xsl] Easy question, big headache.
From: Patrick Bergeron <pbergeron@xxxxxxxxxxx>
Date: Tue, 11 Mar 2008 02:20:20 -0400

Hello XSLT experts... I am trying to do something simple but it's proving to be a major pain in the bottom. Can someone help?


I have a XML document with a list of records:


<Record>
   <Data />
</Record>
<Record>
<Record>
<......>
<Record>


And I need to output some of these records, but not all of them. The rules upon which I decide to output are complex, and I won't bore you with the
details.


Also, after every 5th record has been output, I need to write some kind of marker in the output stream.

Something like this:

Marker
Record 1
Record 23
Record 45
Record 70
Record 72
Marker
Record 83
....



How exactly would I go about doing this?

In any other language, it's easy easy:

If (yes_output_record)
{
  count = count + 1;

  if (count modulo 5 = zero)
     output_marker();

  output_record();
}


I can't understand why it's so complicated to do something like this. Surely there must be some "easy as pie" solution out there?




Thank you.


Current Thread
Keywords