tags:

views:

716

answers:

3

I would like to remove the line break that follows all text that says See the Exhibit "

Unwanted linebreak as shown in notepadd++:

alt text

This is what I have so far:

<xsl:template match="p">
<!-- output everything but the See the exhibit text should have the line break removed -->

</xsl:template>

Any ideas? Thanks!

+1  A: 

Check out the following link...

There is many different methods depending on exactly you are trying to do.

http://www.dpawson.co.uk/xsl/sect2/N8321.html

Jeffrey Hines
A: 
     <!-- Get text. Replace all “break with “ -->
     <xsl:variable name="linebreak">
      <xsl:text>
</xsl:text>
     </xsl:variable>
     <xsl:variable name="text">
      <xsl:call-template name="replace-string">
       <xsl:with-param name="text" select="."/>
       <xsl:with-param name="replace" select="concat('“',$linebreak)" />
       <xsl:with-param name="with" select="string('“')"/>
      </xsl:call-template>
     </xsl:variable>


     <xsl:value-of select="$text"/>
joe
And where would the `replace-string` template be?
Robert Rossney
+1  A: 

If you're using your transform to generate HTML output, the simplest approach is usually:

<xsl:value-of select="normalize-space($text)"/>

normalize-space strips leading and trailing whitespace, and replaces runs of multiple whitespace characters within the string with a single space.

To remove exactly a trailing CR/LF pair:

<xsl:choose>
   <xsl:when test="substring(., string-length(.)-1, 2) = '&#xD;&#xA;'">
      <xsl:value-of select="substring(., 1, string-length(.)-2)"/>
   </xsl:when>
   <xsl:otherwise>
      <xsl:value-of select="."/>
   </xsl:otherwise>
</xsl:choose>
Robert Rossney