By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Blank lines

P: 5
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:

Expand|Select|Wrap|Line Numbers
  1. <!--Gets responses-->
  2. <xsl:template match="node()" name="getResponses">
  3.    <xsl:param name="resp" select="." />
  4.        <xsl:for-each select="audit_response/resp[1][not(.=preceding::audit_response/resp[1])] | audit_response/resp[1][not(.=following::audit_response/resp[1])]">
  5.          <xsl:variable name="resps" select="."/>
  6.         <xsl:value-of select="$resps"/> 
  7.        </xsl:for-each>
  8.  
  9.  </xsl:template>
  10.  
  11.  <!--brings back unique responses -->
  12.                   <fo:table-row>
  13.                    <fo:table-cell>
  14.                     <fo:block font="Arial" text-align="left" font-size="8pt" font-weight="normal" space-after="2px">
  15.                         <fo:inline font-weight="bold">
  16.                        <xsl:call-template name="getResponses">
  17.                         <xsl:with-param name="resp" select="../audit_response/resp" />
  18.                        </xsl:call-template>
  19.                       </fo:inline>                                   
  20.                     </fo:block>                            
  21.                    </fo:table-cell>
The XML document is very long so I will give a snippet of it here.

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" ?> 
  2. - <report>
  3. - <audit>
  4.   <auditid>159</auditid> 
  5.   <auditlevel_id>21</auditlevel_id> 
  6.   <levelstring>AUDIT LIBRARY</levelstring> 
  7.   <auditname>Cory</auditname> 
  8.   <cust_id>2</cust_id> 
  9.   <ld>1</ld> 
  10.   <li>8</li> 
  11. - <questions>
  12. - <question>
  13.   <id>13756</id> 
  14.   <sec_id>0</sec_id> 
  15.   <sub_sec_id>0</sub_sec_id> 
  16.   <item_id>0</item_id> 
  17.   <questiontype>Header</questiontype> 
  18.   <resp_num>1</resp_num> 
  19.   <itemdescription>Cory</itemdescription> 
  20.   <possible_score>10.00</possible_score> 
  21.   <score_criteria /> 
  22.   <udf_info /> 
  23. - <audit_response>
  24.   <id>13389</id> 
  25.   <questionid>13756</questionid> 
  26.   <resp /> 
  27.   <narr /> 
  28.   <score>.00</score> 
  29.   <p_o>0</p_o> 
  30.   <n_o>0</n_o> 
  31.   <p_f>0</p_f> 
  32.   <n_f>0</n_f> 
  33.   <answered>0</answered> 
  34.   <udf_info /> 
  35.   <corr_acts /> 
  36.   </audit_response>
  37.   </question>
  38. - <question>
  39.   <id>13757</id> 
  40.   <sec_id>1</sec_id> 
  41.   <sub_sec_id>0</sub_sec_id> 
  42.   <item_id>0</item_id> 
  43.   <questiontype>Header</questiontype> 
  44.   <resp_num>1</resp_num> 
  45.   <itemdescription>Section 1 - Enter section 1 description.</itemdescription> 
  46.   <possible_score>10.00</possible_score> 
  47.   <score_criteria /> 
  48.   <udf_info /> 
  49. - <audit_response>
  50.   <id>13390</id> 
  51.   <questionid>13757</questionid> 
  52.   <resp /> 
  53.   <narr /> 
  54.   <score>.00</score> 
  55.   <p_o>0</p_o> 
  56.   <n_o>0</n_o> 
  57.   <p_f>0</p_f> 
  58.   <n_f>0</n_f> 
  59.   <answered>0</answered> 
  60.   <udf_info /> 
  61.   <corr_acts /> 
  62.   </audit_response>
  63.   </question>
  64. - <question>
  65.   <id>13758</id> 
  66.   <sec_id>1</sec_id> 
  67.   <sub_sec_id>1</sub_sec_id> 
  68.   <item_id>0</item_id> 
  69.   <questiontype>Header</questiontype> 
  70.   <resp_num>1</resp_num> 
  71.   <itemdescription>Section 1, SubSection 1 - Enter section 1, subsection 1 description.</itemdescription> 
  72.   <possible_score>10.00</possible_score> 
  73.   <score_criteria /> 
  74.   <udf_info /> 
  75. - <audit_response>
  76.   <id>13391</id> 
  77.   <questionid>13758</questionid> 
  78.   <resp /> 
  79.   <narr /> 
  80.   <score>.00</score> 
  81.   <p_o>0</p_o> 
  82.   <n_o>0</n_o> 
  83.   <p_f>0</p_f> 
  84.   <n_f>0</n_f> 
  85.   <answered>0</answered> 
  86.   <udf_info /> 
  87.   <corr_acts /> 
  88.   </audit_response>
  89.   </question>
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
Jul 19 '06 #1
Share this Question
Share on Google+
1 Reply


P: 5
Hi,

A quick note to let you know I figured this out. Unbelievably stupid error :-)
The code to bring back the unique responses was in a table row. The adjacent cell which did a count on each unique response had a space-after property set to 5px. I removed this and it was smooth sailing.
I appreciate your help.
Jul 31 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.