XSLT Escape Character not working

Posted by liveek on Stack Overflow See other posts from Stack Overflow or by liveek
Published on 2012-03-26T09:27:13Z Indexed on 2012/03/26 11:29 UTC
Read the original article Hit count: 459

Filed under:
|

I am trying to use escape charaters in my text output, as i would like too surround the output in emailData tags. I am using

<xsl:text>&#60;emailData&#62;</xsl:text>

In the XSLT to esnure that this works however because i am using a tool called Cast Iron for some reason it is not converting the &#60; into < and just spits out &lt;emailData>

You can see am image of it HERE that illustrates the output i am getting. My source code is this. How else could i wrap this in emailData tags?

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text"/>

    <xsl:template match="header">
        <xsl:text>&#60;emailData&#62;</xsl:text>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>From: </xsl:text>
        <xsl:value-of select="from/text()"/>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>To: </xsl:text>
        <xsl:value-of select="to/text()"/>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>Subject: </xsl:text>
        <xsl:value-of select="subject/text()"/>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>Content-Type: </xsl:text>
        <xsl:value-of select="contentType/text()"/>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>  boundary="</xsl:text>
        <xsl:value-of select="boundary/text()"/>
        <xsl:text>"</xsl:text>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>MIME-Version: </xsl:text>
        <xsl:value-of select="mimeVersion/text()"/>
    </xsl:template>

    <xsl:template match="email">
        <xsl:text>&#10;&#10;</xsl:text>
        <xsl:text>--</xsl:text>
        <xsl:value-of select="../header/boundary/text()"/>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>Content-Type: </xsl:text>
        <xsl:value-of select="contentTypeBody/text()"/>
        <xsl:text> charset="us-ascii"</xsl:text>
        <xsl:text>&#10;</xsl:text>
        <xsl:text>Content-Transfer-Encoding: </xsl:text>
        <xsl:value-of select="contentTransfer/text()"/>
        <xsl:text>&#10;&#10;</xsl:text>
        <xsl:value-of select="body/text()"/>
    </xsl:template>

    <xsl:template match="Attachment">
        <xsl:for-each select="Attachments">
            <xsl:text>&#0010;&#0010;</xsl:text>
            <xsl:value-of select="../../header/boundary/text()"/>
            <xsl:text>&#10;</xsl:text>
            <xsl:text>Content-Type: </xsl:text>
            <xsl:value-of select="attachmentContentType/text()"/>
            <xsl:text> name="</xsl:text>
            <xsl:value-of select="attachmentDescription/text()"/>
            <xsl:text>"</xsl:text>
            <xsl:text>&#10;</xsl:text>
            <xsl:text>Content-Description: </xsl:text>
            <xsl:value-of select="attachmentDescription/text()"/>
            <xsl:text>&#10;</xsl:text>
            <xsl:text>Content-Disposition: attachment; filename="</xsl:text>
            <xsl:value-of select="atachementDisposition/text()"/>
            <xsl:text>"</xsl:text>
            <xsl:text>&#10;</xsl:text>
            <xsl:text>Content-Transfer-Encoding: </xsl:text>
            <xsl:value-of select="attachmentContentTransfer/text()"/>
            <xsl:text>&#10;&#10;</xsl:text>
            <xsl:value-of select="attachementBody/text()"/>
            <xsl:text>&#10;</xsl:text>
            <xsl:text>&#60;/emailData&#62;</xsl:text>
        </xsl:for-each>
    </xsl:template>

    <xsl:template match="text()"/>

</xsl:stylesheet>

© Stack Overflow or respective owner

Related posts about xslt

Related posts about ansi-escape