xsl-list
[Top] [All Lists]

Re: Carriage Return & # 13 ;

2002-12-03 14:57:45
You are looking for a line break, which may not be the same as
carriage return. I am not sure what the rules really are on
line break normalization or if any of that is done in text nodes.
I believe not. So, you need to seach for 
 and 
 or
any combination thereof.


<Text>This is a carriage
return</Text>

2.a) This is the template I wrote:
-------------------------
<xsl:template name="Text" mode="Text"> <xsl:param name="Text"/> <xsl:variable name="UC13">&#13;</xsl:variable> <xsl:choose>
            <xsl:when test="contains($Text,$UC13)">
                <xsl:call-template name="Text">
                    <xsl:with-param name="Text" 
select="concat(substring-before($Text,'$UC13'),' UC13 ',substring-after($Text,'$UC13'))"/>
                </xsl:call-template>
            </xsl:when>
        </xsl:choose>



why do you use mode and param here? They do not pertain to the
problem you're describing. Suggest:

<xsl:variable name="UC13" select="'&#13'"/>

instead of creating the carriage return as a text node.

I can see that this template doesn't work, but stack overflow? You
are doing other screwy things perhaps :-)

Your XSLT style is too procedural. Try avoiding use of xsl:choose
and xsl:call-template. You seem to be breaking the text node only
in order to glue it back together. Why? What is it you want to
accomplish?

You definitely have all the original line break characters inside
text node, the preserve-space etc. has nothing to do with what's
going on *inside* a text node. You definitely will find the
line break characters in the test node with contains and
substring-before etc.

regards,
-Gunther


--
Gunther Schadow, M.D., Ph.D.                    
gschadow(_at_)regenstrief(_dot_)org
Medical Information Scientist      Regenstrief Institute for Health Care
Adjunct Assistant Professor        Indiana University School of Medicine
tel:1(317)630-7960                         http://aurora.regenstrief.org



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>