Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: translate function grabs both feeds even if I tell it to do one

From: "Dimitre Novatchev" <dnovatchev@-----.--->
To: NULL
Date: 3/2/2005 7:58:00 PM
Add xml:space='preserve' to the declaration of $LF and $CR (otherwise their 
contents is stripped by default and their value is the empty string).

The rest should be clear.

Cheers,
Dimitre Novatchev.

P.S. So, you can see that the parser has not let in any CRs

"Mark Bosley" <mark.nspam@l...> wrote in message 
news:%23eDLNRrHFHA.1392@T......
>I know Xml parsers are supposed to convert CRLF's to LF only. But in the 
>stylesheet below I can see CR's. So I tried to strip out CR's with a 
>translate function. But when I do that, the LF's are gone too.
> The stylesheet below produces
> T has LF's
>   T has CR's
> I am expecting
> B has LF's
>   B has CR's
>   T has LF's
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:msxsl="urn:schemas-microsoft-com:xslt">
> <xsl:output method="text" />
> <xsl:variable name="T">Extensible Stylesheet Language Transformations. 
> along with the XML Path.
> This is a point
> and another:
> and yet another:
> </xsl:variable>
> <xsl:variable name="CR">&#x0D;</xsl:variable>
> <xsl:variable name="LF">&#x0A;</xsl:variable>
> <xsl:variable name="B"><xsl:value-of select="translate($T, $CR, 
> '')"/></xsl:variable>
> <xsl:template match="/">
>  <root>
>   <xsl:if test="contains($B, $LF)">B has LF's
>   </xsl:if>
>   <xsl:if test="contains($B, $CR)">B has CR's
>   </xsl:if>
>   <xsl:if test="contains($T, $LF)">T has LF's
>   </xsl:if>
>   <xsl:if test="contains($T, $CR)">T has CR's
>   </xsl:if>
>  </root>
> </xsl:template>
> </xsl:stylesheet>
>
> If the translate function is something like <xsl:value-of 
> select="translate($T, 'A', 'B')"/>
> then CF and LF stays put.
>
> Any ideas?  Thanks Mark B
> 




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