Hi,
I'm very new to xslt and this is my first time posting to a Forum so please forgive me if I transgress any protocols.
I have to do a tally report. This report is divided up into sections. Each section has a list of questions. Each question has responses.
I need to display a list of responses to the questions (i.e. set:distinct), once and only once, each section.
My second problem is that these questions can also have corrective actions associated with them (CAR's in the report). The first section has 5 CAR's but when I do a sum I get the result 2-1-2 instead of 5.
This is a cut down version of the xml I'm working with (I have to use XSLT 1.0 transforming using FOP):
- <?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>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>11602</id>
-
<question_id>13759</question_id>
-
<resp>N/a</resp>
-
<narr>Standard Action Test Narrative</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>
-
<corr_acts>
-
<corr_act>
-
<id>1</id>
-
</corr_act>
-
<corr_act>
-
<id>3</id>
-
</corr_act>
-
</corr_acts>
-
</audit_response>
-
...
This is my stylesheet:
And this is how the report looks:
Sections List# Response Tally CAR
1-0-0 words 3 N/a 1 2
1 Yes 1 1
1 No 1 2
1 No 1
2-0-0 1 Yes 1 1
1 No 1
1 Yes 1
This report should print No only once for section 1-0-0 with a count of two. It should print Yes only once for section 2-0-0 with a count of 2. It should print a total of 5 for the CAR's in section 1-0-0 and only 1 (as it does) for section 2-0-0.
Sorry this is such a long post.
Thanks
Debbie