[Home] [By Thread] [By Date] [Recent Entries]
Hi,
I hope this gets through...I'm having trouble getting through to your mailing list. I'm using XALAN and XSLT1.0 to generate a report in pdf format in FOP 0.20.5. My editor is Netbeans. This is my problem: My xml document stores a list of questions and responses to the questions. These questions are divided up into sections (i.e section 1-0-0 has a list of questions and responses, section 2-0-0 has a list of questions and resposnses and so on). I need to return a list of unique responses per section. The code I have now fails when there are 3 consecutive answers. For instance if the last 2 responses in section one are No and the first response in section 2 is No the report prints No twice in section 1 and doesn't print at all in section 2. I've tried all of the archives and still can't find a solution. I've tried the muenchian method as well and couldn't get it right. Note: Though this report uses Yes, No as responses the responses will be generated dynamically and could be anything not necessarily yes and no. Report currently looks like: 1-0-0 section Yes No No 2-0-0 Yes Report should look like: 1-0-0 Yes No 2-0-0 No Yes This is my code: <!--brings back unique responses -->
<fo:table-row>
<fo:table-cell>
<fo:block font="Arial" text-align="left"
font-size="8pt" space-before="0px" font-weight="normal"
space-after="0px" linefeed-treatment="ignore"
white-space-collapse="true" white-space-treatment="ignore"
wrap-option="no-wrap" >
<xsl:for-each
select="audit_response/resp[1][not(.=preceding::audit_response/resp[1])]
| audit_response/resp[1][not(.=following::audit_response/resp[1])]">
<xsl:if
test="not(../resp=following-sibling::audit_response/resp[1] )">
<text /><xsl:value-of
select="child::text()" /><text />
</xsl:if>
</xsl:for-each>
</fo:block>
</fo:table-cell>Attached is my xml and the full stylesheet: XML <?xml version="1.0" encoding="UTF-8" ?> <report> <audit> <auditid>159</auditid> <auditlevel_id>21</auditlevel_id> <levelstring>AUDIT LIBRARY</levelstring> <auditname>Cory</auditname> <cust_id>2</cust_id> <ld>1</ld> <li>8</li> <questions> <question> <id>13756</id> <sec_id>0</sec_id> <sub_sec_id>0</sub_sec_id> <item_id>0</item_id> <questiontype>Header</questiontype> <resp_num>1</resp_num> <itemdescription>Cory</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11393</id> <questionid>13756</questionid> <resp /> <narr /> <score>.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>0</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13757</id> <sec_id>1</sec_id> <sub_sec_id>0</sub_sec_id> <item_id>0</item_id> <questiontype>Header</questiontype> <resp_num>1</resp_num> <itemdescription>Section 1 - Enter section 1 description.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11394</id> <questionid>13757</questionid> <resp /> <narr /> <score>.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>0</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13758</id> <sec_id>1</sec_id> <sub_sec_id>1</sub_sec_id> <item_id>0</item_id> <questiontype>Header</questiontype> <resp_num>1</resp_num> <itemdescription>Section 1, SubSection 1 - Enter section 1, subsection 1 description.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11395</id> <questionid>13758</questionid> <resp /> <narr /> <score>.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>0</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13761</id> <sec_id>1</sec_id> <sub_sec_id>2</sub_sec_id> <item_id>0</item_id> <questiontype>Header</questiontype> <resp_num>1</resp_num> <itemdescription>Section 1, SubSection 2 - Enter section 1, subsection 2 description.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11396</id> <questionid>13761</questionid> <resp /> <narr /> <score>.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>0</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13764</id> <sec_id>2</sec_id> <sub_sec_id>0</sub_sec_id> <item_id>0</item_id> <questiontype>Header</questiontype> <resp_num>1</resp_num> <itemdescription>Section 2 - Enter section 1 description.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11397</id> <questionid>13764</questionid> <resp /> <narr /> <score>.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>0</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13765</id> <sec_id>2</sec_id> <sub_sec_id>1</sub_sec_id> <item_id>0</item_id> <questiontype>Header</questiontype> <resp_num>1</resp_num> <itemdescription>Section 2, SubSection 1 - Enter section 2, subsection 1 description.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11398</id> <questionid>13765</questionid> <resp /> <narr /> <score>.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>0</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13770</id> <sec_id>2</sec_id> <sub_sec_id>2</sub_sec_id> <item_id>0</item_id> <questiontype>Header</questiontype> <resp_num>1</resp_num> <itemdescription>Section 2, SubSection 2 - Enter section 2, subsection 2 description.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11399</id> <questionid>13770</questionid> <resp /> <narr /> <score>.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>0</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13759</id> <sec_id>1</sec_id> <sub_sec_id>1</sub_sec_id> <item_id>1</item_id> <questiontype>SelectResponse</questiontype> <resp_num>3</resp_num> <itemdescription>Standard Action Test</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <s_rs> <s_r> <seq>3</seq> <narr>Standard Action Test Narrative</narr> <followup>efdqde</followup> </s_r> </s_rs> <udf_info /> <audit_response> <id>11400</id> <questionid>13759</questionid> <resp>Yes</resp> <narr>Company:</narr> <score>10.00</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <answered>1</answered> <udf_info /> <corr_acts /> </audit_response> </question> <question> <id>13762</id> <sec_id>1</sec_id> <sub_sec_id>2</sub_sec_id> <item_id>1</item_id> <questiontype>SelectResponse</questiontype> <resp_num>1</resp_num> <itemdescription>Section 1, Subsection 2, Item 1 - Enter an audit definition / question.</itemdescription> <possible_score>10.00</possible_score> <score_criteria>Testing **********</score_criteria> <udf_info> <udf> <id>491</id> <type>1</type> <label>Test UDF</label> <data /> <udforder>1</udforder> </udf> <udf> <id>492</id> <type>4</type> <label>Color</label> <data>Red,Blue,Green</data> <udforder>2</udforder> </udf> </udf_info> <audit_response> <id>11401</id> <question_id>13762</question_id> <resp>No</resp> <narr /> <score>0.0</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <question_type>SelectResponse</question_type> <answered>1</answered> <recordChanged>Y</recordChanged> <udf_info> <udf> <id>491</id> <type>0</type> <label>null</label> <value /> </udf> <udf> <id>492</id> <type>0</type> <label>null</label> <value /> </udf> </udf_info> </audit_response> </question> <question> <id>13766</id> <sec_id>2</sec_id> <sub_sec_id>1</sub_sec_id> <item_id>1</item_id> <questiontype>SelectResponse</questiontype> <resp_num>1</resp_num> <itemdescription>Section 2, Subsection 1, Item 1 - Enter an audit definition / question.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11402</id> <question_id>13766</question_id> <resp>No</resp> <narr /> <score>0.0</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <question_type>SelectResponse</question_type> <answered>1</answered> <recordChanged>Y</recordChanged> </audit_response> </question> <question> <id>13768</id> <sec_id>2</sec_id> <sub_sec_id>2</sub_sec_id> <item_id>1</item_id> <questiontype>SelectResponse</questiontype> <resp_num>1</resp_num> <itemdescription>Section 2, Subsection 2, Item 1 - Enter an audit definition / question.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11403</id> <question_id>13768</question_id> <resp>Yes</resp> <narr /> <score>10.0</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <question_type>SelectResponse</question_type> <answered>1</answered> <recordChanged>Y</recordChanged> </audit_response> </question> <question> <id>13760</id> <sec_id>1</sec_id> <sub_sec_id>1</sub_sec_id> <item_id>2</item_id> <questiontype>SelectResponse</questiontype> <resp_num>1</resp_num> <itemdescription>Section 1, Subsection 1, Item 2 - Enter an audit definition / question.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11404</id> <question_id>13760</question_id> <resp>Yes</resp> <narr /> <score>10.0</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <question_type>SelectResponse</question_type> <answered>1</answered> <recordChanged>Y</recordChanged> </audit_response> </question> <question> <id>13763</id> <sec_id>1</sec_id> <sub_sec_id>2</sub_sec_id> <item_id>2</item_id> <questiontype>SelectResponse</questiontype> <resp_num>1</resp_num> <itemdescription>Section 1, Subsection 2, Item 2 - Enter an audit definition / question.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11405</id> <question_id>13763</question_id> <resp>No</resp> <narr /> <score>0.0</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <question_type>SelectResponse</question_type> <answered>1</answered> <recordChanged>Y</recordChanged> </audit_response> </question> <question> <id>13767</id> <sec_id>2</sec_id> <sub_sec_id>1</sub_sec_id> <item_id>2</item_id> <questiontype>SelectResponse</questiontype> <resp_num>1</resp_num> <itemdescription>Section 2, Subsection 1, Item 2 - Enter an audit definition / question.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11406</id> <question_id>13767</question_id> <resp>Yes</resp> <narr /> <score>10.0</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <question_type>SelectResponse</question_type> <answered>1</answered> <recordChanged>Y</recordChanged> </audit_response> </question> <question> <id>13769</id> <sec_id>2</sec_id> <sub_sec_id>2</sub_sec_id> <item_id>2</item_id> <questiontype>SelectResponse</questiontype> <resp_num>1</resp_num> <itemdescription>Section 2, Subsection 2, Item 1 - Enter an audit definition / question.</itemdescription> <possible_score>10.00</possible_score> <score_criteria /> <udf_info /> <audit_response> <id>11407</id> <question_id>13769</question_id> <resp>Yes</resp> <narr /> <score>10.0</score> <p_o>0</p_o> <n_o>0</n_o> <p_f>0</p_f> <n_f>0</n_f> <question_type>SelectResponse</question_type> <answered>1</answered> <recordChanged>Y</recordChanged> </audit_response> </question> </questions> <corr_acts /> <auditcompletedby>1</auditcompletedby> <user_name>sa</user_name> <customername /> <comments /> <recommendations /> <action /> <audit_date>Feb 28 2012 3:33PM</audit_date> </audit> <customer_info> <customer> <id>22</id> <cust_name>Aggregate Industries US</cust_name> <users> <user> <id>45</id> <last_name>Aaronson</last_name> <first_name>Aaron</first_name> </user> <user> <id>69</id> <last_name>Otoole</last_name> <first_name>Mike</first_name> </user> </users> <ca_types /> </customer> <customer> <id>19</id> <cust_name>AllansCustomer</cust_name> <users> <user> <id>63</id> <last_name>Kid</last_name> <first_name>Karate</first_name> </user> <user> <id>64</id> <last_name>Ripper</last_name> <first_name>Jackson</first_name> </user> <user> <id>60</id> <last_name>Smith</last_name> <first_name>Allan</first_name> </user> <user> <id>61</id> <last_name>T</last_name> <first_name>Mr</first_name> </user> <user> <id>62</id> <last_name>Wiggin</last_name> <first_name>Ender</first_name> </user> <user> <id>68</id> <last_name>Zoid</last_name> <first_name>Al</first_name> </user> </users> <ca_types /> </customer> <customer> <id>2</id> <cust_name /> <users> <user> <id>23</id> <last_name>Administrator</last_name> <first_name>Customer</first_name> </user> <user> <id>24</id> <last_name>Black</last_name> <first_name>Bob</first_name> </user> <user> <id>53</id> <last_name>Bush</last_name> <first_name>George</first_name> </user> <user> <id>48</id> <last_name>Cramm</last_name> <first_name>Cory</first_name> </user> <user> <id>33</id> <last_name>Davis</last_name> <first_name>Dave</first_name> </user> <user> <id>28</id> <last_name>Dawe</last_name> <first_name>Dorothy</first_name> </user> <user> <id>2</id> <last_name>Dicks</last_name> <first_name>Brian</first_name> </user> <user> <id>34</id> <last_name>Edwards</last_name> <first_name>Ed</first_name> </user> <user> <id>3</id> <last_name>Feltham</last_name> <first_name>Larry</first_name> </user> <user> <id>32</id> <last_name>Goode</last_name> <first_name>Johnny</first_name> </user> <user> <id>19</id> <last_name>Haines</last_name> <first_name>Krista</first_name> </user> <user> <id>12</id> <last_name>House</last_name> <first_name>Steve</first_name> </user> <user> <id>13</id> <last_name>Jefferd</last_name> <first_name>Lois</first_name> </user> <user> <id>47</id> <last_name>me</last_name> <first_name>me</first_name> </user> <user> <id>25</id> <last_name>Mooney</last_name> <first_name>Matthew</first_name> </user> <user> <id>51</id> <last_name>Murphy</last_name> <first_name>Mike</first_name> </user> <user> <id>11</id> <last_name>One</last_name> <first_name>User</first_name> </user> <user> <id>26</id> <last_name>Power</last_name> <first_name>Debbie</first_name> </user> <user> <id>58</id> <last_name>Reports</last_name> <first_name>Crystal</first_name> </user> <user> <id>18</id> <last_name>simpson</last_name> <first_name>homer</first_name> </user> <user> <id>21</id> <last_name>Test Account</last_name> <first_name>Another</first_name> </user> <user> <id>20</id> <last_name>User Account</last_name> <first_name>Test</first_name> </user> <user> <id>22</id> <last_name>Whelan</last_name> <first_name>Michael</first_name> </user> <user> <id>49</id> <last_name>z</last_name> <first_name>z</first_name> </user> </users> <ca_types> <ca_type> <id>7</id> <type_name>Customer Complaint</type_name> </ca_type> <ca_type> <id>8</id> <type_name>Audit Non Conformance</type_name> </ca_type> <ca_type> <id>9</id> <type_name>Preventative Action</type_name> </ca_type> <ca_type> <id>10</id> <type_name>Observation (non audit)</type_name> </ca_type> <ca_type> <id>11</id> <type_name>Public Safety</type_name> </ca_type> <ca_type> <id>13</id> <type_name>Testing</type_name> </ca_type> <ca_type> <id>14</id> <type_name>Field Observation</type_name> </ca_type> <ca_type> <id>17</id> <type_name>Security</type_name> </ca_type> <ca_type> <id>21</id> <type_name>APTA non conformance</type_name> </ca_type> </ca_types> </customer> <customer> <id>21</id> <cust_name>Audit</cust_name> <users> <user> <id>67</id> <last_name></last_name> <first_name></first_name> </user> </users> <ca_types> <ca_type> <id>41</id> <type_name>jar ops 175</type_name> </ca_type> </ca_types> </customer> <customer> <id>18</id> <cust_name /> <users> <user> <id>59</id> <last_name /> <first_name /> </user> </users> <ca_types /> </customer> </customer_info> </report> <? Stylesheet: <?xml version="1.0" encoding="UTF-8" ?> <!--
Document : tallyReport.xsl
Created on : July 17, 2006
Author : dpower
Description:
Combination of corrective action report and tally
report. Now referred to
as Summary Report--> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xalan="http://xml.apache.org/xalan" xmlns:java="http://xml.apache.org/xslt/java" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <!-- keys for the Summary Report--> <xsl:key name="response" match="audit_response" use="resp"/> <xsl:key name="responseNum" match="report/audit/questions/question" use="resp_num"/> <xsl:key name="car" match="report/audit/questions/question" use="audit_response/corr_acts/corr_act"/> <xsl:key name="response2" match="report/audit/questions/question" use="audit_response/resp" /> <xsl:key name="corracts" match="report/audit/questions/question" use="audit_response/corr_acts/corr_act/id" /> <xsl:key name="keys_sec_id" match="report/audit/questions/question" use="sec_id" /> <!--end of keys--> <xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4"
page-height="10in" page-width="8in" margin-top="1cm"
margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
<fo:region-before region-name="rptHeader" extent="4.8cm" />
<fo:region-body margin-bottom="2.8cm" margin-top="4.8cm" />
<fo:region-after extent="2cm"/>
</fo:simple-page-master>
</fo:layout-master-set><fo:page-sequence master-reference="simpleA4"> <fo:static-content flow-name="rptHeader" > <!-- REPORT HEADER --> <fo:table table-layout="fixed"
inline-progression-dimension="18cm" cell-spacing="0" cell-padding="0">
<fo:table-column column-width="6cm" />
<fo:table-column column-width="9cm" />
<fo:table-column column-width="3.5cm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell >
<fo:external-graphic width="2.0in" height="0.75in"
src="file:./IATAlogo.jpg" />
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell number-columns-spanned="3">
<fo:block font-size="12pt" text-align="right"
font="Arial" font-weight="bold" >Summary Report</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell number-columns-spanned="3">
<fo:block border-bottom-style="solid"
border-bottom-color="#000000"
border-top-color="#000000" border-bottom-width="thin"
border-top-width="thin" space-after="5px" >
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed"
inline-progression-dimension="18cm" cell-spacing="0" cell-padding="0">
<fo:table-column column-width="6cm" />
<fo:table-column column-width="9cm" />
<fo:table-column column-width="3.5cm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font="Arial" font-size="9pt"
font-weight="bold">Customer:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font="Arial" font-size="9pt">
<xsl:value-of select="report/audit/customername" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="9pt" font="Arial"
font-weight="bold">Audit Location:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font="Arial" font-size="9pt">
<xsl:value-of select="report/audit/levelstring" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="9pt" font="Arial"
font-weight="bold">Audit Name:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font="Arial" font-size="9pt">
<xsl:value-of select="report/audit/auditname" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font="Arial" font-size="9pt"
font-weight="bold">Audit Date:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font="Arial" font-size="9pt" space-afer="5px">
<xsl:value-of select="report/audit/audit_date" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell number-columns-spanned="3">
<fo:block border-bottom-style="solid"
border-bottom-color="#000000"
border-top-color="#000000" border-bottom-width="thin"
border-top-width="thin" space-after="5px" >
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content><!--Ends report header--> <!--Begins Report footer--> <fo:static-content flow-name="xsl-region-after">
<fo:block font-size="10pt" font-weight="normal">
<fo:table table-layout="fixed" inline-progression-dimension="18cm">
<fo:table-column column-width="1.5cm" />
<fo:table-column column-width="14.5cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="8pt" font-weight="normal">
<xsl:variable name="date"><xsl:value-of
select="date:date-time()" /></xsl:variable>
<xsl:value-of select="substring($date,1,10)" />
</fo:block>
</fo:table-cell>
<fo:table-cell>
</fo:table-cell>
<fo:table-cell>
<fo:block font-size="8pt" font-weight="normal">Page
<fo:page-number/> / <fo:page-number-citation
ref-id="last-page"/></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:static-content>
<!--Ends report footer-->
<!-- beginning of Tally Report --> <fo:table table-layout="fixed"
inline-progression-dimension="18.5cm" cell-spacing="0"
cell-padding="0">
<fo:table-column column-width="8cm"/>
<fo:table-column column-width="1cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="1.5cm"/>
<fo:table-column column-width=".1cm"/>
<fo:table-column column-width="1.5cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell >
<fo:block font-size="12pt" font="Arial"
font-weight="bold" space-after="5px" >
Results Tally By Section
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell number-columns-spanned="6">
<fo:block border-bottom-style="solid"
border-bottom-color="#000000"
border-top-color="#000000" border-bottom-width="thin"
border-top-width="thin" space-after="5px" >
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<xsl:variable name="group"
select="audit_response/resp[1][not(.=preceding::audit_response/resp[1])]
| audit_response/resp[1][not(.=following::audit_response/resp[1])]"/>
<fo:table-cell />
<fo:table-cell>
<fo:block font="Arial" text-align="center"
font-size="8pt" font-weight="normal" space-after="0px"> <xsl:if test="not(sec_id >=0 and sub_sec_id
>=0 and item_id=0)">
<xsl:if test="sec_id=$test">
<xsl:if test="$group != ''">
<xsl:choose> <!--begins the outside choose -->
<xsl:when test="sec_id">
<fo:block font="Arial" text-align="center"
font-size="8pt" font-weight="normal" space-after="0px">
<xsl:variable name="sec_id" select="sec_id"/> <xsl:if
test="not(../resp=following-sibling::audit_response/resp[1] )">
<xsl:value-of
select="count(../question[sec_id =
$sec_id]/audit_response/resp[.=$group])"/>
</xsl:if>
</fo:block>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:if>
</xsl:if>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</fo:table-body>
</fo:table><!--Ends first section of Tally Report--> <!-- Tally Report - Summary Section--> <fo:table table-layout="fixed" inline-progression-dimension="18.5cm"
cell-spacing="0" cell-padding="0" space-after="10px">
<fo:table-column column-width="8cm" />
<fo:table-column column-width="1cm" />
<fo:table-column column-width="2cm" />
<fo:table-column column-width="1.5cm" />
<fo:table-column column-width=".1cm" />
<fo:table-column column-width="1.5cm" /> <fo:table-body>
<fo:table-row>
<fo:table-cell number-columns-spanned="7">
<fo:block border-bottom-style="solid"
border-bottom-color="#000000" border-top-color="#000000"
border-bottom-width="thin"
border-top-width="thin" space-after="5px" >
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell >
<fo:block font-size="12pt" font="Arial" font-weight="bold"
space-after="5px" >
Results Tally Summary
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell >
<fo:block font="Arial" text-align="left" font-size="8pt"
font-weight="normal" space-after="2px">
<xsl:for-each
select="report/audit/questions/question[generate-id() =
generate-id(key('response2',audit_response/resp)[1])]">
<xsl:sort data-type="number" select="sec_id"/>
<xsl:sort data-type="number" select="sec_id"/>
<xsl:sort data-type="number" select="sub_sec_id"/>
<xsl:sort data-type="number" select="item_id"/>
<xsl:if test="not(audit_response/resp='')" >
<fo:block></fo:block>
<xsl:value-of select="audit_response/resp"/>
</xsl:if>
</xsl:for-each>
</fo:block>
</fo:table-cell>
<fo:table-cell />
<fo:table-cell >
<fo:block font="Arial" text-align="center"
font-size="8pt" font-weight="normal" space-after="2px">
<xsl:for-each
select="report/audit/questions/question[count(.| key('response2',
audit_response/resp)[1]) = 1]">
<xsl:if test="not(audit_response/resp='')" >
<fo:block></fo:block>
<xsl:if
test="not(count(key('response2',audit_response/resp))=0)">
<xsl:value-of
select="count(key('response2',audit_response/resp))"/>
</xsl:if>
</xsl:if>
</xsl:for-each>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell >
<fo:block font="Arial" text-align="left"
font-size="10pt" font-weight="normal" space-after="6px" >
Corrective Action Records (CARs)
</fo:block>
</fo:table-cell>
<fo:table-cell />
<!-- brings back a count of the cars per answered question -->
<fo:table-cell>
<fo:block font="Arial" text-align="center"
font-size="8pt" font-weight="normal" space-after="2px">
<xsl:choose>
<xsl:when test="/report/audit/questions/question">
<xsl:if test="not(audit_response/resp='')" >
<xsl:if test="not(audit_response/corr_acts/corr_act='')">
<xsl:if test="not(audit_response/corr_acts/corr_act/id=0)">
<xsl:value-of select="count(//corr_act) div 2"/>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:when>
</xsl:choose>
</fo:block>
</fo:table-cell>
</fo:table-row><!--end of CAR code -->
</fo:table-body>
</fo:table>
<!--Ends Tally Report--><fo:table table-layout="fixed" inline-progression-dimension="18.5cm"
cell-spacing="0" cell-padding="0" space-after="10px">
<fo:table-column column-width="8cm" />
<fo:table-column column-width="1cm" />
<fo:table-column column-width="2cm" />
<fo:table-column column-width="1.5cm" />
<fo:table-column column-width="2.5cm" />
<fo:table-column column-width=".5cm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell number-columns-spanned="7">
<fo:block border-bottom-style="solid"
border-bottom-color="#000000" border-top-color="#000000"
border-bottom-width="thin"
border-top-width="thin" space-after="5px" >
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="12pt" font="Arial"
font-weight="bold" space-before="4px" space-after="5px" >
Corrective Action Records
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table> <xsl:apply-templates select="report/audit/corr_acts/corr_act"/>
<fo:block id="last-page"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template><xsl:template match="report/audit/corr_acts/corr_act">
<xsl:when test="status = 3">
Final Completed
</xsl:when> <xsl:when test="status = 4">
Review
</xsl:when> <xsl:when test="status = 5">
Closed
</xsl:when>
</xsl:choose>
</fo:inline>
</fo:block>
<fo:block font="Arial" font-size="8pt" space-after="7px">
<fo:block font="Arial" font-size="10pt" font-weight="bold"
space-before="5px" space-after="3px"
text-decoration="underline" >
Basis For Corrective Action
</fo:block>
<fo:table table-layout="fixed" inline-progression-dimension="12cm">
<fo:table-column column-width="10cm" />
<fo:table-column column-width="3cm" />
<fo:table-column column-width="3cm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block font="Arial" font-size="8pt" space-after="3px" >
<fo:inline font-weight="bold">Initiated By: </fo:inline>
<xsl:call-template name="getUserName">
<xsl:with-param name="customerId"
select="/report/audit/cust_id" />
<xsl:with-param name="userId" select="init_by" />
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font="Arial" font-size="8pt" space-after="3px" >
<fo:inline font-weight="bold">Date: </fo:inline>
<xsl:value-of select="date_init"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font="Arial" font-size="8pt" space-after="3px">
<fo:inline font-weight="bold">Priority: </fo:inline>
<xsl:choose>
<xsl:when test="priority = 1">
High
</xsl:when> <xsl:when test="priority = 2">
Medium
</xsl:when> <xsl:when test="priority = 3">
Low
</xsl:when>
</xsl:choose>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block font="Arial" font-size="8pt" space-after="3px" >
<fo:inline font-weight="bold">Type(s): </fo:inline>
<xsl:apply-templates select="types/type"/>
</fo:block>
<fo:block font="Arial" font-size="8pt" space-after="3px" >
<fo:inline font-weight="bold">
<xsl:call-template name="getSections">
<xsl:with-param name="caId" select="id" />
</xsl:call-template>
</fo:inline>
<xsl:call-template name="getQuestionText">
<xsl:with-param name="caId" select="id" />
</xsl:call-template>
</fo:block>
<fo:block font="Arial" font-size="8pt" space-after="3px" >
<fo:inline font-weight="bold">Description: </fo:inline>
<xsl:value-of select="act_desc"/>
</fo:block> </fo:block>
</xsl:template><xsl:template match="report/corr_acts/corr_act/types/type"> <xsl:variable name="cId" select="/report/audit/cust_id"/> <xsl:variable name="typeId" select="id"/> <xsl:if test="position() = last()"> <xsl:value-of select="/report/customer_info/customer[id=$cId]/ca_types/ca_type[id=$typeId]/type_name"/> </xsl:if> <xsl:if test="position() != last()"> <xsl:value-of select="concat(/report/customer_info/customer[id=$cId]/ca_types/ca_type[id=$typeId]/type_name,', ')"/> </xsl:if> </xsl:template>
<!--Gets a user name based on CustomerId ans UserId--> <xsl:template match="node()" name="getUserName"> <xsl:param name="customerId" select="." /> <xsl:param name="userId" select="." /> <xsl:value-of select="concat(/report/customer_info/customer[id=$customerId]/users/user[id=$userId]/first_name,' ',/report/customer_info/customer[id=$customerId]/users/user[id=$userId]/last_name)" /> </xsl:template>
<!--<xsl:if test="/report/audit/questions/question/audit_response/corr_acts/corr_act[id=$caId]/id = $caId"> </xsl:if>--> <xsl:for-each select="/report/audit/questions/question/audit_response/corr_acts/corr_act[id=$caId]"> <fo:block>
<!--<xsl:value-of
select="concat(../../../sec_id,'-',../../../sub_sec_id,'-',../../../item_id,'
',../../../itemdescription)"/>-->
<xsl:value-of select="(../../../itemdescription)"/>
</fo:block>
</xsl:for-each></xsl:template> <!--Gets sec-id,sub-sec-id and item-id Text based on Corrective Action ID--> <xsl:template match="node()" name="getSections"> <xsl:param name="caId" select="." /> <xsl:for-each
select="/report/audit/questions/question/audit_response/corr_acts/corr_act[id=$caId]">
<xsl:sort data-type="number" select="sec_id"/>
<xsl:sort data-type="number" select="sub_sec_id"/>
<xsl:sort data-type="number" select="item_id"/>
<fo:block>
Question(s): <xsl:value-of
select="concat(../../../sec_id,'-',../../../sub_sec_id,'-',../../../item_id)"
/>
</fo:block>
</xsl:for-each></xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="*[not(normalize-space())]"/> </xsl:stylesheet>
|

Cart



