I don't know how much effort you do for calculating the mean,
but this is straightforward in XSLT
<xsl:template match="userdata">
<xsl:value-of select="name"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="profession"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="sum(acadrecord/inp
<xsl:value-of select="$newline"/>
</xsl:template>
Main Topics
Browse All Topics





by: GertonePosted on 2007-04-10 at 23:01:21ID: 18887672
There are several ways to get to Excel from XML.
rg/1999/XS L/Transfor m" version="1.0"> text> text>
Depending on your needs you could use an XML schema, bind it to a table and import the XML directly. Or you could use special tools dediacted to writing Excel files.
If you want to use XSLT, again you have some options (though you can't write binary Excel)
You could write the Excel XML format. You then have most of the bells and whistles, but it is a complex format.
You can also write simple HTML tables, in order to pass some formatting.
In simple cases, you can write tab seperated text, which you then import in Excel.
That is what this example does
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.o
<xsl:param name="newline" select="' '"/>
<xsl:param name="tab" select="'	'"/>
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:text>name</xsl:text>
<xsl:value-of select="$tab"/>
<xsl:text>profession</xsl:
<xsl:value-of select="$tab"/>
<xsl:text>gradpoints</xsl:
<xsl:value-of select="$newline"/>
<xsl:apply-templates select="//userdata"/>
</xsl:template>
<xsl:template match="userdata">
<xsl:value-of select="name"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="profession"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="gradpoints"/>
<xsl:value-of select="$newline"/>
</xsl:template>
</xsl:stylesheet>
cheers
Geert