473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Blank lines

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
1 2939
DAnne
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

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

Similar topics

6
by: Ruben | last post by:
Hello. I am trying to read a small text file using the readline statement. I can only read the first 2 records from the file. It stops at the blank lines or at lines with only spaces. I have a...
3
by: puzzlecracker | last post by:
I want to read lines and skip blank lines: would this work considering the lines can contain tabs, spaces, etc.? file.in: ------ line1 line2
6
by: Melissa | last post by:
Does anyone have a generic procedure for adding blank lines to reports like Sales details, PO details and/or Orders details. The procedure would need to count the number of line items, determine...
4
by: Ryan S | last post by:
I am trying to read an XML document generated by a web server using the XMLTextReader class, but the document generated appears to have some blank lines at the top that are causing problems. If...
3
by: Jeff Calico | last post by:
Hello everyone I am transforming an XML document to text, basically only outputting a small portion of it. When I run the following XSLT via Xalan's processor, I get a bunch of unwanted blank...
1
by: satya.mahesh | last post by:
Hi All, I am working on a problem which "eliminates blank lines in export (between headings and when a heading is empty)". I want a macro which will do this job for me. For e.g: Heading1 ...
4
by: Andreas Bauer | last post by:
Hi, I have to audit some c# code. I know in the options I can adjust how the code should be formatted while entering it. But is there any way to apply afterwards a code template to the classes...
25
by: tmallen | last post by:
I'm parsing some text files, and I want to strip blank lines in the process. Is there a simpler way to do this than what I have here? lines = filter(lambda line: len(line.strip()) 0, lines) ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.