How to create xlsx file from XML, with using XSLT in java -


i able create xls file old format, microsoft spreadsheet 97-2003, rather go newer.

how create newer xlsx format?

i use javax.xml.transform java package.

here chunk of java code

tfactory = transformerfactory.newinstance(); transformer = tfactory.newtransformer(new streamsource("file.xslt")); transformer.transform(streamsource, new streamresult(new fileoutputstream(filenamexls))); 

i have tried using different xsl stylesheet definition, didn't help.

this xlst file.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>  <xsl:stylesheet version="1.0" xmlns="urn:schemas-microsoft-com:office:spreadsheet"                 xmlns:xsl="http://www.w3.org/1999/xsl/transform"                 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">    <xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="-//w3c//dtd xhtml 1.1 strict//en" version="1.0"               doctype-system="http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd" xml:lang="pl" />   <xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/>    <xsl:template match="/">      <worksheet ss:protected="0" ss:name="name">         <html>             <head>                 <meta http-equiv="content-type" content="text/html; charset=utf-8" />                 <style>                     td {                         margin:auto;                         text-align:center;                         vertical-align:middle;                     }                     table th h2 {                         background-color:rgb(198,239,206);                     }                     th.important {                         background-color:rgb(255,235,166);                     }                 </style>             </head>             <body>                 <table border="1">                 <tr><th>                 <h2>articles</h2>                 </th></tr>                 </table>                 <table border="1">                     <tr>                         <th>lp.</th>                         <th class="important">title</th>                         <th class="important">date</th>                         <th class="important">autors</th>                         <th class="important">afilliated</th>                         <th class="important">employed</th>                      </tr>                     <xsl:for-each select="works/article">                         <tr>                             <td><xsl:value-of select="lp"/></td>                             <td><xsl:value-of select="title"/></td>                             <td><xsl:value-of select="publication-date"/></td>                             <td>                                 <ul>                                     <xsl:for-each select="./author">                                         <li>                                             <xsl:value-of select="given-names"/>&#160;<xsl:value-of select="family-name"/>                                         </li>                                     </xsl:for-each>                                 </ul>                             </td>                             <td>                                 <ul>                                     <xsl:for-each select="./author">                                         <li>                                             <xsl:value-of select="affiliated-to-unit"/>                                         </li>                                     </xsl:for-each>                                 </ul>                             </td>                             <td>                                 <ul>                                     <xsl:for-each select="./author">                                         <li>                                             <xsl:value-of select="employed-in-unit"/>                                         </li>                                     </xsl:for-each>                                 </ul>                             </td>                         </tr>                     </xsl:for-each>                 </table>             </body>         </html>     </worksheet>    </xsl:template> </xsl:stylesheet> 


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -