Hi,
I have checked your archives but have not been able to find anything that works for my situation. I have a for loop that brings back a list of unique responses for each section in a report. These responses are responses to each question in a particular section.
This is working fine. However the output prints many blank lines. I have determined that these lines are are actually places where the question had the same response as a previous question but where I only want unique responses these duplicates do not print. I need to remove these blank lines but I couldn't find anything that would work.
This is the part of the code in my stylesheet that returns the unique responses with the blank lines:
The XML document is very long so I will give a snippet of it here.
My report looks like this:
1-0-0 section
this is a unique response (No)
this is another unique response (Yes)
1-2-0 new section
this is a unique response for this section (Yes)
You can imagine the amount of blank lines that result in a large report. Any help would be greatly appreciated.
Thanks
I have checked your archives but have not been able to find anything that works for my situation. I have a for loop that brings back a list of unique responses for each section in a report. These responses are responses to each question in a particular section.
This is working fine. However the output prints many blank lines. I have determined that these lines are are actually places where the question had the same response as a previous question but where I only want unique responses these duplicates do not print. I need to remove these blank lines but I couldn't find anything that would work.
This is the part of the code in my stylesheet that returns the unique responses with the blank lines:
Code:
<!--Gets responses-->
<xsl:template match="node()" name="getResponses">
<xsl:param name="resp" select="." />
<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:variable name="resps" select="."/>
<xsl:value-of select="$resps"/>
</xsl:for-each>
</xsl:template>
<!--brings back unique responses -->
<fo:table-row>
<fo:table-cell>
<fo:block font="Arial" text-align="left" font-size="8pt" font-weight="normal" space-after="2px">
<fo:inline font-weight="bold">
<xsl:call-template name="getResponses">
<xsl:with-param name="resp" select="../audit_response/resp" />
</xsl:call-template>
</fo:inline>
</fo:block>
</fo:table-cell>
Code:
<?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>13389</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>13390</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>13391</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>
1-0-0 section
this is a unique response (No)
this is another unique response (Yes)
1-2-0 new section
this is a unique response for this section (Yes)
You can imagine the amount of blank lines that result in a large report. Any help would be greatly appreciated.
Thanks
Comment