[xsl] FW: No sure how to start this xsl logic wise

Subject: [xsl] FW: No sure how to start this xsl logic wise
From: "Danny Leblanc" <leblancd@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 Aug 2006 15:16:28 -0400
Hello everyone.

  This is my first time posting here so please let me know if anything in my
post is incorrect. I am fairly new to XSL though I do understand the basics
pretty well. I use XSL to transform XML "data files" from customer into an XML
format that is more friendly to the printing software that we sell.

  I have a data file that looks something like this. (It is rather large so I
will just post the "layout")

  <usage>
      .
  <usage>
  <total>
  </total>
  <usage>
      .
  <usage>
  <total>
  </total>
  <usage>
      .
  <usage>
  <total>
  </total>

Where the period is means there can be any number of usage nodes. Basically it
is a cell phone invoice and each usage is a call made on the phone. The total
is the totals for that specific phone number. An invoice can contain multiple
phone numbers (for a company perhaps that has multiple phones with the same
company).

My problem.

The software we use here with XML runs on printers (not much memory) and
everything on one level in XML = loaded into memory. So if I would load a
large clients information like this onto 1 level, it will "bust" the printer's
memory and the job will not print. However, if I can get logical groupings of
usage into a node with the same parent, I can break on that and only load the
information that fits on one print page at a time.

The physical printed page is 2 columns. Each time the phone number changes we
complete the column. Also, if we get 52 calls in a column, we are full and
need to break to the next column. What I am looking for is a method to take
this file and convert it to something like this.

<page>
  <leftcolumn>
    <usage>
         .
    </usage>
  </leftcolumn>
  <rightcolumn>
    <usage>
        .
    </usage>
    <total>
    </total>

What I am not clear on is how to I keep the select the right number of usages.
A "column" can contain up to 52 usages but might contain fewer if we hit the
end of the current phone number's details. (<total>). Also, 1 phone number
could theoretically span many "<pages>".

Any help you could provide would be fantastic. I am not sure where to start
with this one.

Danny

Current Thread