[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How does one convert an RTF to a string?

Subject: Re: How does one convert an RTF to a string?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 9 Jun 2005 21:59:59 +0100
convert rtf to string
>     Why am I not getting the whitepsaces in my RTF or the comments?

comments within a stylesheet are ignored, always.
White space is ignored by default but you can cause it not to be ignored
within your element definition. by using xml:space="preserve" or
xsl:preserve-space 


Note if you do get a comment node (eg if your real case is nodes copied
from some source) then you wouldn't want


        <xsl:template match="comment()" mode="convert">
                <xsl:comment><xsl:value-of select="." /></xsl:comment>
        </xsl:template>

you'd want


        <xsl:template match="comment()" mode="convert">
 <xsl:text>&lt;!--</xsl:text>
<xsl:value-of select="." />
 <xsl:text>--&gt;</xsl:text>
        </xsl:template>

If your real case is a fixed variable in teh stylesheet you don't want
to this at all, you just want to define the variable to have the string
not the nodes in teh first place


                <xsl:variable name="rtf"><![CDATA[
                                <node>
                                        <!-- Here is a comment -->

                                        <child attrib="something" >value</child>
                                </node>
                </xsl:variable>

                <xsl:variable name="tmpStr">
                <xsl:apply-templates select="xalan:nodeset($rtf)"
mode="convert" />
                ]]></xsl:variable>

                <xsl:value-of select="rtf" />


I note in your example you used disable-output-escaping use of that is
always always a sign that somethng is wrong. Here it looks very odd
You disable the normal XML serialisation by using value-of and d-o-e
which means thatyou have to serialise everything by hand.

Why not just let the system use its normal XML serialisation, by just
copying the original rtf  variable to the result tree???




                <xsl:variable name="rtf">
                                <node>
                                        <!-- Here is a comment -->

                                        <child attrib="something" >value</child>
                                </node>
                </xsl:variable>

                <xsl:variable name="tmpStr">
                <xsl:apply-templates select="xalan:nodeset($rtf)"
mode="convert" />
               </xsl:variable>

                <xsl:copy-of select="rtf" />

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.