K
Kevin
I'm a newbie at XML and have a situation that needs to EXPORT a
summary list for import into EXCEL.
I'm using the simple_style sheet supplied by Filemaker and it does the
job EXCEPT... it exports the fields (and field names) horizontally
when opened in EXCEL (columns A-W).
I would like it to export vertically (rows 1-22) when opened in EXCEL.
Can anyone shed some light on what needs to be done to this style
sheet (if it can be done within this style sheet)? I've toyed around
with it a bit (3 hours) and have yet to get the result I want.
Any help greatly appreciated!
Kevin
Kevin Morrison
HERE IS THE CODE FOR THE STYLE SHEET AS IS COMPLIMENTS OF FILEMAKER
PRO, INC.
***********
-->
<!--
Template: match="fmp:FMPXMLRESULT"
The main driver for building the table. Calls the header template then
iterates through
the RESULTSET nodeset to build the table rows.
-->
<xsl:template match="fmp:FMPXMLRESULT">
<html>
<body>
<table border="1" cellPadding="1" cellSpacing="1">
<xsl:call-template name="header"/>
<xsl:for-each select="fmp:RESULTSET/fmp:COL">
<tr>
<xsl:for-each select="fmp:ROW">
<td>
<xsl:value-of select="fmp
ATA"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
<!--
Template: header
Creates the heading for the HTML table. The database name and number
of records
are displayed above the field names.
-->
<xsl:template name="header">
<tr>
<td align="middle">
<xsl:attribute name="colspan"><xsl:call-template
name="numfields"/></xsl:attribute>
<xsl:text>Database: </xsl:text>
<xsl:value-of select="fmp
ATABASE/@NAME"/>
</td>
</tr>
<tr>
<td align="middle">
<xsl:attribute name="colspan"><xsl:call-template
name="numfields"/></xsl:attribute>
<xsl:text>Records: </xsl:text>
<xsl:value-of select="fmp
ATABASE/@RECORDS"/>
</td>
</tr>
<tr>
<xsl:for-each select="fmp:METADATA/fmp:FIELD">
<td align="middle">
<xsl:value-of select="@NAME"/>
</td>
</xsl:for-each>
</tr>
</xsl:template>
<!--
Template: numfields
Simple utility template that checks for the number of children in the
METADATA
element and returns the number of fields in the database - handy when
building
tables.
-->
<xsl:template name="numfields" match="fmp:METADATA">
<xsl:value-of select="count(fmp:METADATA/child::*)"/>
</xsl:template>
</xsl:stylesheet>
*****************
summary list for import into EXCEL.
I'm using the simple_style sheet supplied by Filemaker and it does the
job EXCEPT... it exports the fields (and field names) horizontally
when opened in EXCEL (columns A-W).
I would like it to export vertically (rows 1-22) when opened in EXCEL.
Can anyone shed some light on what needs to be done to this style
sheet (if it can be done within this style sheet)? I've toyed around
with it a bit (3 hours) and have yet to get the result I want.
Any help greatly appreciated!
Kevin
Kevin Morrison
HERE IS THE CODE FOR THE STYLE SHEET AS IS COMPLIMENTS OF FILEMAKER
PRO, INC.
***********
-->
<!--
Template: match="fmp:FMPXMLRESULT"
The main driver for building the table. Calls the header template then
iterates through
the RESULTSET nodeset to build the table rows.
-->
<xsl:template match="fmp:FMPXMLRESULT">
<html>
<body>
<table border="1" cellPadding="1" cellSpacing="1">
<xsl:call-template name="header"/>
<xsl:for-each select="fmp:RESULTSET/fmp:COL">
<tr>
<xsl:for-each select="fmp:ROW">
<td>
<xsl:value-of select="fmp
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
<!--
Template: header
Creates the heading for the HTML table. The database name and number
of records
are displayed above the field names.
-->
<xsl:template name="header">
<tr>
<td align="middle">
<xsl:attribute name="colspan"><xsl:call-template
name="numfields"/></xsl:attribute>
<xsl:text>Database: </xsl:text>
<xsl:value-of select="fmp
</td>
</tr>
<tr>
<td align="middle">
<xsl:attribute name="colspan"><xsl:call-template
name="numfields"/></xsl:attribute>
<xsl:text>Records: </xsl:text>
<xsl:value-of select="fmp
</td>
</tr>
<tr>
<xsl:for-each select="fmp:METADATA/fmp:FIELD">
<td align="middle">
<xsl:value-of select="@NAME"/>
</td>
</xsl:for-each>
</tr>
</xsl:template>
<!--
Template: numfields
Simple utility template that checks for the number of children in the
METADATA
element and returns the number of fields in the database - handy when
building
tables.
-->
<xsl:template name="numfields" match="fmp:METADATA">
<xsl:value-of select="count(fmp:METADATA/child::*)"/>
</xsl:template>
</xsl:stylesheet>
*****************