xsl-list
[Top] [All Lists]

Output escaped characters that represent the CR as an attribute

2004-09-29 11:41:44
Hi, all,

I have a requirement to out the escaped characters that represent the
CR as an attribute.What I want is:

<TagwithAttribute att1="XXXX&#x0D;&#x0A;YYYY"/>

Regards an old posts in this list, we can output these characters as:
<xsl:text disable-output-escaping="yes">XXXX&amp;#x0D;&amp;#x0A;YYYY</xsl:text>

However, this works fine to element only, doesn't work if I want to
assgin this to an attribute.Please see the following files.

Any replys are highly appreciated.

thanks.
Good2all

Source XML File:
------------------
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="x0Dx0A_Test.xslt"?>
<dummy/>

------------------
XSLT file:
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<xsl:template match="/">
<someTag>
        <xsl:text 
disable-output-escaping="yes">XXXX&amp;#x0D;&amp;#x0A;YYYY</xsl:text>
        <tagwithattri>
                <xsl:attribute name="att1">
                        <xsl:text 
disable-output-escaping="yes">XXXX&amp;#x0D;&amp;#x0A;YYYY</xsl:text>
                </xsl:attribute>
        </tagwithattri>
</someTag>
</xsl:template>
</xsl:stylesheet>


--------------------
Output XML File:
----------------------
<?xml version="1.0" encoding="UTF-8"?>
<someTag xmlns:fo="http://www.w3.org/1999/XSL/Format";>XXXX&#x0D;&#x0A;YYYY
<tagwithattri att1="XXXX&amp;#x0D;&amp;#x0A;YYYY"/>
</someTag>

----------------------