You might want to try this:
 <gmr:Cells>
        <xsl:apply-templates select="page/content/rowset/row">
                <xsl:with-param name="rowposition" select="position()"/>
        </xsl:apply-templates>
 </gmr:Cells>



and then use <xsl:param name="rowposition"/> where you need to set Row="" instead of re-counting your rows every time. Also this: you might want to set your Row directly through a shortcut:
<gmr:Cell Row="{$rowposition}"> as the content of {} will be evaluated by xsl.


    <xsl:variable name="rownumber"><xsl:number level="any" from="content"
> count="row"/></xsl:variable>
>       <xsl:attribute name="Row">
>          <xsl:value-of select="$rownumber"/>
>       </xsl:attribute>
>

Didn't try this myself but think this might work.

Kind Regards,
Jan



Philipp Rech wrote:
Hello Cocooners,

[Cocoon Version 2.1.6]

i have the following xml file (see below) which is the result of a db querry
(from Cocoon)... when i transfrom it with the stylesheet (see below) using the
transfomer within Cocoon an excel sheet opens but with only one row in it (the
one with the last id) but i need all elements in diferent rows... so only the
last <row> element with the <eventid>2</eventid> gets displayed but not both of
them... my guess was thet the first one is processed but is overwritten by the
last one (see my xml and xsl file below)

thank you very much!
phil

ps: i already asekd on the poi-user list but
got no reply...


here is my xml file:
--------------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?> <page>
<content>
<rowset xmlns:sql="http://apache.org/cocoon/SQL/2.0";
xmlns="http://apache.org/cocoon/SQL/2.0";>
<row>
<eventid>3</eventid> <typeofcontrol>Control Type A</typeofcontrol> <trafficdirection>Entry</trafficdirection> <checkpoint>Blue Border</checkpoint> <klassification>illigal</klassification> <checklocation>black sea</checklocation> <guard_1>Philipp</guard_1> <guard_2>Peter Pan</guard_2> <objection>smug</objection> <dtg>2005-01-01</dtg> <location>black sea</location> <description></description> <numberofpersons>3</numberofpersons> <observed>Yes</observed> </row>
<row>
<eventid>2</eventid> <typeofcontrol>Control Type B</typeofcontrol> <trafficdirection>Leave/trafficdirection> <checkpoint>Airport</checkpoint> <klassification>illigal entry</klassification> <checklocation>airport hall 2</checklocation> <guard_1>Philipp</guard_1> <guard_2>Stepht</guard_2> <objection>illigal enrty</objection> <dtg>2005-01-12</dtg> <location>airport somewhere</location> <description>none</description> <numberofpersons>1</numberofpersons> <observed>No</observed> </row>
</rowset>
</content>
</page>
---------------------------------


here is my xsl file:

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

<?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 xmlns:gmr="http://www.gnome.org/gnumeric/v7";>
     <gmr:Sheets>
         <gmr:Sheet DisplayFormulas="false" HideZero="false" HideGrid="false"
HideColHeader="false" HideRowHeader="false" DisplayOutlines="true"
OutlineSymbolsBelow="true" OutlineSymbolsRight="true">
                 <gmr:Name>BIHS - Event Data</gmr:Name>
                 <gmr:MaxCol>2</gmr:MaxCol>
                 <gmr:Cols DefaultSizePts="48">
                     <gmr:ColInfo No="0" Unit="48" MarginA="2" MarginB="2"
Count="7"/>
                 </gmr:Cols>
                 <gmr:Rows DefaultSizePts="12.8">
                        <gmr:RowInfo No="0" Unit="12.8" MarginA="0" MarginB="0" 
Count="9"/>
                        <gmr:RowInfo No="10" Unit="12.8" MarginA="1" MarginB="0" 
Count="24"/>
                 </gmr:Rows>
                 <gmr:Cells>
                        <xsl:apply-templates/>
                 </gmr:Cells>
        </gmr:Sheet>
     </gmr:Sheets>
    </gmr:Workbook>
  </xsl:template>



<xsl:template match="sql:eventid">
<gmr:Cell Col="0" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>
<xsl:template match="sql:typeofcontrol">
<gmr:Cell Col="1" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>



<xsl:template match="sql:trafficdirection">
<gmr:Cell Col="2" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>




<xsl:template match="sql:checkpoint ">
<gmr:Cell Col="3" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>
<xsl:template match="sql:klassification">
<gmr:Cell Col="4" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>



<xsl:template match="sql:guard_1">
<gmr:Cell Col="5" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>
<xsl:template match="sql:guard_2">
<gmr:Cell Col="6" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>
<xsl:template match="sql:objection">
<gmr:Cell Col="7" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template> <xsl:template match="sql:dtg">
<gmr:Cell Col="8" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template> <xsl:template match="sql:location">
<gmr:Cell Col="9" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>
<xsl:template match="sql:description">
<gmr:Cell Col="10" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template> <xsl:template match="sql:numberofpersons">
<gmr:Cell Col="11" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template> <xsl:template match="sql:observed">
<gmr:Cell Col="12" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any" from="content"
count="row"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="$rownumber"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/> </gmr:Content>
</gmr:Cell>
</xsl:template>




</xsl:stylesheet>


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to