xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Douglas" <edoug...@blockhouse.com>
Subject RE: XSLT Help
Date Fri, 10 Sep 2010 14:32:46 GMT
You already have the XSL to print the months and years and all you need
is the method to add up the data fields?
It sounds like you have the hard part done.
Look up the sum method.
http://www.w3schools.com/Xpath/xpath_functions.asp 

-----Original Message-----
From: CRANFORD, CHRIS [mailto:Chris.Cranford@setech.com] 
Sent: Friday, September 10, 2010 10:23 AM
To: fop-users@xmlgraphics.apache.org
Subject: XSLT Help


I am struggling with the best way to parse the following XML section
from my document with XSLT using FOP.

<document>
  <usage>
    <record>
      <year>2010</year>
      <month>1</month>
      <quantity>1</quantity>
    </record>
    <record>
      <year>2009</year>
      <month>3</month>
      <quantity>2</quantity>
    </record>
  </usage>
</document>

In the PDF output, what I actually need to be able to produce is to take
the current year (2010) and go backward a total of
4 years.  The XML document could contain data in this section that dates
back prior to 2006 and that information is just not used in this output.


The PDF should look like the following:

     J F M A M J J A S O N D Total
     - - - - - - - - - - - - -----
2010 1 0 0 0 0 0 0 0 0 0 0 0     1
2009 0 0 2 0 0 0 0 0 0 0 0 0     2

The XSLT starts with 2010, searches for data for month 1 and steps by 1
until 12, keeping a total and then displays the yearly total, decrements
the year, resets the month to 1 and starts the process over.  

During each step, I need to examine the XML document to find if data
exists for the year/month in /document/usage/record by those two data
values and if not, default a 0 usage; otherwise read the value of
/quantity from the record.

Anyone have any suggestions on the best way to do this?

Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message