xsl-list
[Top] [All Lists]

RE: [xsl] why no indent here

2011-12-12 09:04:22
This is probably happening because the template you copied from dpawson.co.uk 
is adding   characters in for some reason. Here's a much simpler template 
that will convert newline characters to <br>:


<xsl:template name="newline-to-br">
        <xsl:param name="string" />
        <xsl:choose>
                <xsl:when test="string($string) and contains($string, '&#10;')">
                        <xsl:value-of select="substring-before($string, 
'&#10;')" />
                        <br />
                        <xsl:call-template name="newline-to-br">
                                <xsl:with-param name="string" 
select="substring-after($string, '&#10;')" />
                        </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                        <xsl:value-of select="$string" />
                </xsl:otherwise>
        </xsl:choose>
</xsl:template>


~ Scott

-----Original Message-----
From: Roelof Wobben [mailto:rwobben(_at_)hotmail(_dot_)com] 
Sent: Monday, December 12, 2011 7:35 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] why no indent here


Learned another thing.

 

Last question.

 

Can it be that by using utf-8 a space is shown as Â



Roelof

 

----------------------------------------
From: bbosgoed(_at_)bkwi(_dot_)nl
Date: Mon, 12 Dec 2011 14:16:22 +0100

 


To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] why no indent here

Roelof,

Check the xpath expression in your xsl file, do they really match the 
elements you think they should match.


Op 12 dec 2011, om 13:25 heeft Roelof Wobben het volgende geschreven:


<xsl:template match="section/entry"> <div class="post"> 
<h3><xsl:value-of select="title"/> </h3> <div class="post-inner"> 
<xsl:apply-templates select="data/section/entry/body/text()" /> 
</div> </div> </xsl:template>

In this template you're in the context of entry.
So the <xsl:apply-templates select="data/section/entry/body/text()"/> is 
matching nothing.

Just do <xsl:apply-templates select="body"/>

And I would change the template to

<xsl:template match="body">
<xsl:call-template name="make-verbatim"> <xsl:with-param name="text" 
select="text()"/> </xsl:call-template> </xsl:template>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
                                        
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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