Re: [xsl] Fwd: xml/xslt line break

Subject: Re: [xsl] Fwd: xml/xslt line break
From: Taly <urania.muse@xxxxxxxxx>
Date: Sun, 20 Jul 2008 15:18:09 +0300
what I need to change is something from xsl I am reading using xpath -
I called it here :txtTargetTextforchange
can you help?

my xsl looks like that:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:import href="common.xslt"/>
<xsl:output method="html" indent="no"/>
=======================
.
.
.
.<xsl:template match="*" mode="Resp">
<table>
.
.
.<td>
<xsl:value-of select="./txtTargetTextforchange" />&#160;
</td>

.
.
.
===

On Sun, Jul 20, 2008 at 2:32 PM, Martin Honnen <Martin.Honnen@xxxxxx> wrote:
> Taly wrote:
>>
>> I am using version 1.0 thats the problem.I saw a samplw in the web but
>> didn't work for me:
>> http://www.dpawson.co.uk/xsl/sect2/break.html#d3080e76
>> perhaps I donno ow to use call-template the way I should
>
> It is not possible to guess where your attempts failed. You will need to
> show us your XML input and your stylesheet trying to process that.
> Perhaps this example helps, the XML is
>
> <root>
>  <foo>Line 1
> Line 2
> Line 3</foo>
> </root>
>
> the stylesheet, incorporating the template from the FAQ looks as follows:
>
>  <xsl:stylesheet
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>    version="1.0">
>
>  <xsl:output method="html" indent="yes"/>
>
>  <xsl:template match="/root">
>    <html>
>      <head>
>        <title>Example</title>
>      </head>
>      <body>
>        <xsl:apply-templates/>
>      </body>
>    </html>
>  </xsl:template>
>
> <xsl:template name="substitute">
>   <xsl:param name="string" />
>   <xsl:param name="from" select="'&#xA;'" />
>   <xsl:param name="to">
>      <br />
>   </xsl:param>
>   <xsl:choose>
>      <xsl:when test="contains($string, $from)">
>         <xsl:value-of select="substring-before($string, $from)" />
>         <xsl:copy-of select="$to" />
>         <xsl:call-template name="substitute">
>            <xsl:with-param name="string"
>                            select="substring-after($string, $from)" />
>            <xsl:with-param name="from" select="$from" />
>            <xsl:with-param name="to" select="$to" />
>         </xsl:call-template>
>      </xsl:when>
>      <xsl:otherwise>
>         <xsl:value-of select="$string" />
>      </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
>
>  <xsl:template match="foo">
>    <div>
>      <xsl:call-template name="substitute">
>        <xsl:with-param name="string" select="."/>
>      </xsl:call-template>
>    </div>
>  </xsl:template>
>
> </xsl:stylesheet>
>
> the result then is
>
> <html>
>   <head>
>      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>
>      <title>Example</title>
>   </head>
>   <body>
>
>      <div>Line 1<br>Line 2<br>Line 3
>      </div>
>
>   </body>
> </html>
>
>
> --
>
>        Martin Honnen
>        http://JavaScript.FAQTs.com/

Current Thread