Hi,
I'm loading up a XSL file into a TXMLDocument using XMLRead. Up to this point everything seems to be ok, and I can query the DOMNodes without problem. If I then save that file out again, using XMLWrite, I noticed that some data is lost. :-/
I don't know if this is because the file is a XSL file? Though I thought XSL is exactly the same structure as XML - so didn't expect any problems.
Anyway, here is a sample area in the XSL file that looses data.
Before:
----8<-------------8<-------------8<-------------8<-------------8<----
<!-- Short Month Name -->
<xsl:template name="format-date-short"><xsl:param name="date"/> <xsl:choose>
<xsl:when test="string-length($date)=0"></xsl:when> <xsl:otherwise>
<xsl:variable name="month">
<xsl:choose>
<xsl:when test="substring($date,1,3)='Jan'">01</xsl:when> <xsl:when test="substring($date,1,3)='Feb'">02</xsl:when> <xsl:when test="substring($date,1,3)='Mar'">03</xsl:when> <xsl:when test="substring($date,1,3)='Apr'">04</xsl:when> <xsl:when test="substring($date,1,3)='May'">05</xsl:when> <xsl:when test="substring($date,1,3)='Jun'">06</xsl:when> <xsl:when test="substring($date,1,3)='Jul'">07</xsl:when> <xsl:when test="substring($date,1,3)='Aug'">08</xsl:when> <xsl:when test="substring($date,1,3)='Sep'">09</xsl:when> <xsl:when test="substring($date,1,3)='Oct'">10</xsl:when> <xsl:when test="substring($date,1,3)='Nov'">11</xsl:when> <xsl:when test="substring($date,1,3)='Dec'">12</xsl:when> </xsl:choose>
</xsl:variable>
<xsl:value-of
select="substring($date,5,2)"/> <xsl:value-of select="$month"/> <xsl:value-of select="substring($date,8,4)"/> </xsl:otherwise>
</xsl:choose>
</xsl:template>
----8<-------------8<-------------8<-------------8<-------------8<----
After the save:
----8<-------------8<-------------8<-------------8<-------------8<---- <!-- Short Month Name -->
<xsl:template name="format-date-short">
<xsl:param name="date"/>
<xsl:choose>
<xsl:when test="string-length($date)=0"/>
<xsl:otherwise>
<xsl:variable name="month">
<xsl:choose>
<xsl:when test="substring($date,1,3)='Jan'">01</xsl:when> <xsl:when test="substring($date,1,3)='Feb'">02</xsl:when> <xsl:when test="substring($date,1,3)='Mar'">03</xsl:when> <xsl:when test="substring($date,1,3)='Apr'">04</xsl:when> <xsl:when test="substring($date,1,3)='May'">05</xsl:when> <xsl:when test="substring($date,1,3)='Jun'">06</xsl:when> <xsl:when test="substring($date,1,3)='Jul'">07</xsl:when> <xsl:when test="substring($date,1,3)='Aug'">08</xsl:when> <xsl:when test="substring($date,1,3)='Sep'">09</xsl:when> <xsl:when test="substring($date,1,3)='Oct'">10</xsl:when> <xsl:when test="substring($date,1,3)='Nov'">11</xsl:when> <xsl:when test="substring($date,1,3)='Dec'">12</xsl:when> </xsl:choose>
</xsl:variable>
<xsl:value-of select="substring($date,5,2)"/>
<xsl:value-of select="$month"/>
<xsl:value-of select="substring($date,8,4)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
----8<-------------8<-------------8<-------------8<-------------8<----
Note the two ' ' escaped characters are lost near the end in the newly written file.
I'm using FPC 2.6.2 under 64-bit FreeBSD, but will be compiling this application for Windows 32-bit and 64-bit idea what is causing this? A bug, because I'm using XSL or anything else maybe?
The XSL file passed all validation tools I could
currently use the full XSL file to populate and generate PDF documents, so I don't believe there is any validation/syntax issues.
In case this is useful, the XSL file starts like this.
----8<-------------8<-------------8<-------------8<-------------8<---- <?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" />
<xsl:decimal-format name="noNaN" decimal-separator="." grouping-separator="," NaN="" />
<xsl:template match="/QUESTIONS">
...snip...
----8<-------------8<-------------8<-------------8<-------------8<----
Regards,
- Graeme -
