Hi
I have a problem with the name of header column in Excel file (xls) generated with XSLT.
For Example:
If I have following query :
select 'month' as '2017-10' from dual;
In the generated Excel I have '2017-10' converted in 0x0032..ecc...
This is the code I use in PL/SQL:
v_context := DBMS_XMLGEN.NEWCONTEXT (v_query);
DBMS_XMLGEN.SETNULLHANDLING (v_context, 1);
DBMS_XMLGEN.SETCONVERTSPECIALCHARS (v_context, true);
v_xml_data := DBMS_XMLGEN.GETXMLTYPE (v_context, DBMS_XMLGEN.NONE);
v_output := v_xml_data.transform (XMLTYPE (v_xls_xsl));
v_clob := tool_email_pkg.xmltype2clob (v_output);
The problem is in the XML generated.
My XSL:
<xsl:stylesheet version="1.0"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" >
<xsl:template match="/*">
<Worksheet>
<xsl:attribute name="ss:Name">
<xsl:value-of select="local-name(/*/*)"/>
</xsl:attribute>
<Table x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="150">
<Row>
<xsl:for-each select="/ROWSET/ROW[1]/*">
<Cell ss:StyleID="StileCella">
<Data ss:Type="String">
<xsl:value-of select="name()"/>
</Data>
</Cell>
</xsl:for-each>
</Row>
<xsl:apply-templates/>
</Table>
</Worksheet>
</xsl:template>
<xsl:template match="/*/*">
<Row>
<xsl:apply-templates/>
</Row>
</xsl:template>
<xsl:template match="/*/*/*">
<Cell>
<Data ss:Type="String">
<xsl:value-of select="." />
</Data>
</Cell>
</xsl:template>
</xsl:stylesheet>
Stefano