Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] To preserve line jumps on having gone on from XML to HTML

From: "Javier de Andr&#xE9;s" <jandres@--------->
To:
Date: 8/2/2004 11:50:00 AM
Hello

Excuse me for my way of expressing in English but I am Spanish and my English 
is bad.

Thank you very much.
 Javi

--
DIIC
Facultad de Imformatica
Universidad de Murcia


---------- Original Message -----------
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Fri, 30 Jul 2004 12:16:51 -0400
Subject: Re: [xsl] To preserve line jumps on having gone on from XML to HTML

> Javi,
> 
> Since the line breaks ("line jumps" is a good but unusual thing to call
> them) are not expressed in your XML, to convert them into markup requires
> processing the string value of the node. In this case, the best XSLT
> solution is to use a recursive template that takes the string and 
> breaks it into pieces one at a time at the Line Break ('jump') 
> character, which is character &#xA; or &#10; (as hexadecimal or 
> decimal character references).
> 
> This could look like:
> 
> <xsl:variable name="delim" select="'&#xA;'"/>
> 
> <xsl:template match="Body">
>    <p>
>      <xsl:call-template name="mark-string">
>        <xsl:with-param name="string-left" select="string(.)"/>
>      </xsl:call-template>
>    </p>
> </xsl:template>
> 
> <xsl:template name="mark-string">
>    <xsl:param name="string-left" select="string(.)"/>
>    <xsl:if test="$block">
>      <xsl:variable name="segment">
>        <xsl:choose>
>          <xsl:when test="contains($string-left,$delim)">
>            <xsl:value-of select="substring-before($string-left,
> $delim)"/>         </xsl:when>         <xsl:otherwise>           
> <xsl:value-of select="$string-left"/>         </xsl:otherwise>       
> </xsl:choose>     </xsl:variable>     <xsl:value-of select="$segment"/>
>      <br/>
>      <xsl:call-template name="mark-string">
>        <xsl:with-param name="string-left"
> select="substring-after($string-left,$delim)"/>
>      </xsl:call-template>
>    </xsl:if>
> </xsl:template>
> 
> This is fully documented in the FAQ at
> http://www.dpawson.co.uk/xsl/sect2/N7240.html (look for "CLRF to BR").
> 
> In XSLT 2.0, where a tokenize() function is available, this is much easier.
> 
> Cheers,
> Wendell
> 
> BTW <Body Articulate>...</Body Articulate> is not well-formed XML; 
> no space can be in the name. Try <Body_Articulate> or maybe <Body 
type="Articulate">.
> 
>   At 06:58 AM 7/30/2004, you wrote:
> >Hello
> >
> >I have a problem, i have a file XML like :
> >
> ><Article>
> >    <title>
> >       Article 1
> >    </title>
> >    <Body Articulate>
> >       - Line
> >       - Another Line
> >       - Another line
> >       Another Line
> >    </Body Articulate>
> ></Article>
> >
> >Then I use a file XSLT to transform it in html, but clear the part of the
> >lines me appears with the line jump, but without a <BR> at the time on 
having
> >seen it in the browser the line jumps do not remain.
> >
> >You know as this might do?
> >
> >Thank you very much
> >  Javi.
> >
> >--
> >DIIC
> >Facultad de Imformatica
> >Universidad de Murcia
> >
> >
> >--
> >DIIC
> >Facultad de Imformatica
> >Universidad de Murcia
> 
> ___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
>      "Thus I make my own use of the telegraph, without consulting
>       the directors, like the sparrows, which I perceive use it
>       extensively for a perch." -- Thoreau
------- End of Original Message -------


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent