473,799 Members | 3,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Blank lines

5 New Member
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 2971
DAnne
5 New Member
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
4301
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 while statement checking for an empty string "" which I understand represents an EOF in Python. The text file has some blank lines with spaces and other with blanks. Thanks a lot.
3
26383
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
5541
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 the remaining page to fill and print blank lines with the same number of fields as the line items. In addition, if there were a long list of line items that carried over to a second and possibly more pages, to print blank lines at the last page. The...
4
3241
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 I connect directly to the URL, when I call the ".Read" method on the XMLTextReader, I get the message: "The XML declaration is unexpected. Line 8, Column 3" If I open the URL in my browser and copy and paste the XML stuff (starting
3
3706
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 lines in the output. Here is a simplified XML and XSLT: (Note the problem does not happen when testing in XMLSpy) - - - - - - - - - - - - - - - - - - - - - - - -
1
1807
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 Heading2
4
2878
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 to adjust their appearance (except ctrl-k ctrl-f)? Foremost how to clear unnecessary blank lines, e.g reduce 4 blank lines to one. I don´t want to change every class manually. Thanks in advance for any hint.
25
1877
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) Thomas
0
9686
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10475
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10222
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.