[xsl] Fwd: Removing blank lines in text output

Subject: [xsl] Fwd: Removing blank lines in text output
From: "Greg Groves" <greg.groves@xxxxxxxxx>
Date: Tue, 6 Mar 2007 09:23:38 -0500
Hmm.... didn't see this is in the archive, so I'm reposting...

---------- Forwarded message ----------
From: Greg Groves <greg.groves@xxxxxxxxx>
Date: Mar 5, 2007 3:19 PM
Subject: Removing blank lines in text output
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx

Hello,

I have some XML I am transforming into text reports using Xalan. Given
the following XML:

       <ORU_R01.ORDER_OBSERVATION>
           <ORU_R01.OBSERVATION>
               <OBX>
                   <OBX.1>1</OBX.1>
                   <OBX.2>TX</OBX.2>
               </OBX>
           </ORU_R01.OBSERVATION>
           <ORU_R01.OBSERVATION>
               <OBX>
                   <OBX.1>2</OBX.1>
                   <OBX.2>TX</OBX.2>
                   <OBX.5>REASON: *SCREENING FOR OSTEOPOROSIS</OBX.5>
               </OBX>
           </ORU_R01.OBSERVATION>
           <ORU_R01.OBSERVATION>
               <OBX>
                   <OBX.1>3</OBX.1>
                   < OBX.2>TX</OBX.2>
               </OBX>
           </ORU_R01.OBSERVATION>
           <ORU_R01.OBSERVATION>
               <OBX>
                   <OBX.1>4</OBX.1>
                   <OBX.2>TX</OBX.2>
                   <OBX.5>ADDITIONAL CLINICAL DATA: BASELINE SCREENING.</OBX.5>
               </OBX>
           </ORU_R01.OBSERVATION>
           <ORU_R01.OBSERVATION>
               <OBX>
                   <OBX.1>5</OBX.1>
                   <OBX.2>TX</OBX.2>
                   <OBX.5>EXAM: OSTEO DEXA-TORSO  03/04/2007</OBX.5>
               </OBX>
           </ORU_R01.OBSERVATION>
           <ORU_R01.OBSERVATION>
               <OBX>
                   <OBX.1>6</OBX.1>
                   < OBX.2>TX</OBX.2>
               </OBX>
           </ORU_R01.OBSERVATION>
           <ORU_R01.OBSERVATION>
                <OBX>
                    <OBX.1>7</OBX.1>
                    <OBX.2>TX</OBX.2>
                </OBX>
            </ORU_R01.OBSERVATION>
        </ORU_R01.ORDER_OBSERVATION>

The actual text lines of the report are in the OBX.5 nodes... the line
numbers are in OBX.1. What I want to do is remove any trailing blank
lines, while leaving blank lines in the midst of the report. So in the
above example, I would write out lines 1 through 5 (including blank
lines 1 and 3), but not output lines 6 and 7. (Of course, the number
of lines is not constant, so I can't simply eliminate by line number.)
Is this possible in XSLT?

Thanks,

Greg Groves

Current Thread