I am using XSL to display an XML representation of an email message in browsers. Email attachments are stored in separate files to the main email XML file, and so I want the resulting web page for the email to contain a link to its attachments.
However some of the attachments are email messages themselves, and may have been forwards or replies and thus may have names containing colons like FW:Important. The name is URL-escaped as FW%3AImportant, and stored as a file as FW%3AImportant.xml.
The problem is that the URL in my XSL-produced web page is unescaped and once again contains the colon (file://FW:Important.xml) and thus is a broken link. What is the best way to stop this behaviour?
Here is the XML snippet:
<email:part email:filename="FW%3AImportant">
<email:attachment filename="FW%3AImportant.xml">
FW%3AImportant.xml
</email:attachment>
</email:part>
And here is the XSL snippet:
<xsl:template match="email:email/email:parts">
<xsl:for-each select="email:part/email:attachment">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@filename" />
</xsl:attribute>
<xsl:value-of select="@filename" />
</a>
</xsl:for-each>
</xsl:template>