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: 454
xslt
|ansi-escape
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><emailData></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 <
into <
and just spits out <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><emailData></xsl:text>
<xsl:text> </xsl:text>
<xsl:text>From: </xsl:text>
<xsl:value-of select="from/text()"/>
<xsl:text> </xsl:text>
<xsl:text>To: </xsl:text>
<xsl:value-of select="to/text()"/>
<xsl:text> </xsl:text>
<xsl:text>Subject: </xsl:text>
<xsl:value-of select="subject/text()"/>
<xsl:text> </xsl:text>
<xsl:text>Content-Type: </xsl:text>
<xsl:value-of select="contentType/text()"/>
<xsl:text> </xsl:text>
<xsl:text> boundary="</xsl:text>
<xsl:value-of select="boundary/text()"/>
<xsl:text>"</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>MIME-Version: </xsl:text>
<xsl:value-of select="mimeVersion/text()"/>
</xsl:template>
<xsl:template match="email">
<xsl:text> </xsl:text>
<xsl:text>--</xsl:text>
<xsl:value-of select="../header/boundary/text()"/>
<xsl:text> </xsl:text>
<xsl:text>Content-Type: </xsl:text>
<xsl:value-of select="contentTypeBody/text()"/>
<xsl:text> charset="us-ascii"</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>Content-Transfer-Encoding: </xsl:text>
<xsl:value-of select="contentTransfer/text()"/>
<xsl:text> </xsl:text>
<xsl:value-of select="body/text()"/>
</xsl:template>
<xsl:template match="Attachment">
<xsl:for-each select="Attachments">
<xsl:text>

</xsl:text>
<xsl:value-of select="../../header/boundary/text()"/>
<xsl:text> </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> </xsl:text>
<xsl:text>Content-Description: </xsl:text>
<xsl:value-of select="attachmentDescription/text()"/>
<xsl:text> </xsl:text>
<xsl:text>Content-Disposition: attachment; filename="</xsl:text>
<xsl:value-of select="atachementDisposition/text()"/>
<xsl:text>"</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>Content-Transfer-Encoding: </xsl:text>
<xsl:value-of select="attachmentContentTransfer/text()"/>
<xsl:text> </xsl:text>
<xsl:value-of select="attachementBody/text()"/>
<xsl:text> </xsl:text>
<xsl:text></emailData></xsl:text>
</xsl:for-each>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
© Stack Overflow or respective owner