I am using an .xsl file as an export filter to convert an Open Office Calc file to xml. One of the fields is the DNI, which in the calc is like D (two blank spaces) XXXXXXXXX. The problem is that when exporting to xml the two blanks become one. Here is the filter code xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" exclude-result-prefixes="office table text">
<xsl:preserve-space elements="*" />
<xsl:template match="/">
<root>
<xsl:apply-templates select="/*/office:body" />
</root>
</xsl:template>
<xsl:template match="office:body">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="office:spreadsheet">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="office:spreadsheet/table:table">
<xsl:for-each select="table:table-row[position() > 1]">
<CIUDADANO><xsl:text>
</xsl:text>
<NIF_NIE>
<xsl:choose>
<xsl:when test="substring(table:table-cell[1]/text:p,3,1)='X' or substring(table:table-cell[1]/text:p,3,1)='Y'">
<xsl:value-of select="replace(table:table-cell[1]/text:p, concat('(^.*?)', 'D'),concat('$1','E'))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="table:table-cell[1]/text:p"/>
</xsl:otherwise>
</xsl:choose>
</NIF_NIE><xsl:text>
</xsl:text>
<UNIDADES_DE_COMPETENCIA><xsl:text>
</xsl:text>
<UNIDAD><xsl:text>
</xsl:text>
<CODIGO><xsl:value-of select="table:table-cell[2]/text:p" /></CODIGO><xsl:text>
</xsl:text>
</UNIDAD><xsl:text>
</xsl:text>
</UNIDADES_DE_COMPETENCIA><xsl:text>
</xsl:text>
</CIUDADANO><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>