How can I transform XML to invalid XML using XSLT?

Posted by Damovisa on Stack Overflow See other posts from Stack Overflow or by Damovisa
Published on 2010-03-23T05:48:17Z Indexed on 2010/03/23 5:53 UTC
Read the original article Hit count: 472

Filed under:
|
|
|
|

I need to transform a valid XML document to the OFX v1.0.2 format. This format is more or less XML, but it's technically invalid and therefore cannot be parsed as XML.

I'm having trouble getting my Xml transformation working because the .Net XslCompiledTransform object insists on interpreting the XSL as an XML document (which is fair enough).

If I escape the xml-ish tags using < and &gt, they get removed when I download the file.

Here's the start of my XSLT:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="text"></xsl:output>
  <xsl:param name="currentdate"></xsl:param>
  <xsl:template match="Transactions">
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
    <SIGNONMSGSRSV1>
        <SONRS>
            <STATUS>
                <CODE>0
                <SEVERITY>INFO
            </STATUS>
            <DTSERVER><xsl:value-of select="$currentdate" />
            <LANGUAGE>ENG

Any suggestions?

© Stack Overflow or respective owner

Related posts about xslt

Related posts about Xml