You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Philipp Rech <re...@iuw.fh-darmstadt.de> on 2005/01/28 10:51:47 UTC

Re: [SOLVED] transformation from XML to excel only works with one element set

Hello,

thank you Jan it works! Here is my new stylesheet
maybe it is usefull for someone...
bye now!
philipp

-------------------------------------------------


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://apache.org/cocoon/SQL/2.0"
xmlns:gmr="http://www.gnome.org/gnumeric/v7">
	<xsl:template match="/">
		<gmr:Workbook>
			<gmr:SheetNameIndex>
				<gmr:SheetName>BIHS-Reporting-Events</gmr:SheetName>
			</gmr:SheetNameIndex>
			<gmr:Sheets>
				<gmr:Sheet>
					<gmr:Name>BIHS-Reporting-Events</gmr:Name>
					<gmr:Styles>
						<gmr:StyleRegion startRow="0" endRow="0" startCol="0" endCol="99">
							<gmr:Style HAlign="8" VAlign="4" WrapText="1" Orient="1" Shade="0"
Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF"
PatternColor="0:0:0" Format="General">
								<gmr:Font Unit="10" Bold="1" Italic="0" Underline="0"
StrikeThrough="0">
                  Helvetica
                </gmr:Font>
							</gmr:Style>
						</gmr:StyleRegion>
					</gmr:Styles>
					<gmr:Cells>
						<xsl:call-template name="headerrow"/>
						<xsl:apply-templates select="/page/content/sql:rowset/sql:row"/>
					</gmr:Cells>
				</gmr:Sheet>
			</gmr:Sheets>
		</gmr:Workbook>
	</xsl:template>
	<xsl:template name="headerrow">
		<gmr:Cell Row="0" Col="0" ValueType="60">Event ID</gmr:Cell>
		<gmr:Cell Row="0" Col="1" ValueType="60">Type of Control</gmr:Cell>
		<gmr:Cell Row="0" Col="2" ValueType="60">Traffic Direction </gmr:Cell>
		<gmr:Cell Row="0" Col="3" ValueType="60">Check Point</gmr:Cell>
		<gmr:Cell Row="0" Col="4" ValueType="60">Classification</gmr:Cell>
		<gmr:Cell Row="0" Col="5" ValueType="60">Location of crime</gmr:Cell>
		<gmr:Cell Row="0" Col="6" ValueType="60">1'th Guard</gmr:Cell>
		<gmr:Cell Row="0" Col="7" ValueType="60">2'nd Guard</gmr:Cell>
		<gmr:Cell Row="0" Col="8" ValueType="60">Objection</gmr:Cell>
		<gmr:Cell Row="0" Col="9" ValueType="60">Date</gmr:Cell>
		<gmr:Cell Row="0" Col="10" ValueType="60">Location of crime</gmr:Cell>
		<gmr:Cell Row="0" Col="11" ValueType="60">Description</gmr:Cell>
		<gmr:Cell Row="0" Col="12" ValueType="60">Nr. of Persons</gmr:Cell>
		<gmr:Cell Row="0" Col="13" ValueType="60">Observed by guard</gmr:Cell>
	</xsl:template>
	<xsl:template match="sql:row">
		<xsl:variable name="row" select="position()"/>
		<gmr:Cell Row="{$row}" Col="0" ValueType="60">
			<xsl:value-of select="sql:eventid"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="1" ValueType="60">
			<xsl:value-of select="sql:typeofcontrol"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="2" ValueType="60">
			<xsl:value-of select="sql:trafficdirection"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="3" ValueType="60">
			<xsl:value-of select="sql:checkpoint"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="4" ValueType="60">
			<xsl:value-of select="sql:klassification"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="5" ValueType="60">
			<xsl:value-of select="sql:checklocation"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="6" ValueType="60">
			<xsl:value-of select="sql:guard_1"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="7" ValueType="60">
			<xsl:value-of select="sql:guard_2"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="8" ValueType="60">
			<xsl:value-of select="sql:objection"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="9" ValueType="60">
			<xsl:value-of select="sql:dtg"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="10" ValueType="60">
			<xsl:value-of select="sql:location"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="11" ValueType="60">
			<xsl:value-of select="sql:description"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="12" ValueType="60">
			<xsl:value-of select="sql:numberofpersons"/>
		</gmr:Cell>
		<gmr:Cell Row="{$row}" Col="13" ValueType="60">
			<xsl:value-of select="sql:observed"/>
		</gmr:Cell>
	</xsl:template>
</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org