RE: [xsl] xsl:number problem

Subject: RE: [xsl] xsl:number problem
From: "Yan, Charlene" <Charlene.Yan@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jun 2003 09:10:13 -0400
Mike,

Thanks for replying.  I'm going to try to show what I need to do.
1.  My xml looks like this:
<solution>
  	<product>
    		<productID>1</productId>
  	</product>
  	<product>
    		<productID>2</productId>
  	</product>
  	<program>
    		<product>
      		<productID>3</productId>
    		</product>
    		<product>
      		<productID>4</productId>
    		</product>
  	</program>
  	<product>
    		<productID>5</productId>
  	</product>
</solution>

2. My xsl looks like this:
<xsl:template match="productId">          
     
     <gmr:Cell Col="1"  Row="27" ValueType="60">
      <xsl:variable name="rownumber"><xsl:number level="any" count="prodctId"/></xsl:variable>      
      <xsl:attribute name="Row">
         <xsl:value-of select="position() + $rownumber + 2"/>
      </xsl:attribute>
       <gmr:Content>
        <xsl:apply-templates/> 
       </gmr:Content>
     </gmr:Cell>
</xsl:template>

3.  The output is like this.  In the Excel spreadsheet, the data cells start from row 27 to 31 in column B.
1
2
3
4
5

4.  What I need to do next is to get the value of the last cell's Row attribute and to position the cells below it.  For example, I want to add Comments in the second cell below the last cell which is 5 in this case.  
1
2
3
4
5

Comments:

5.  I tried the following:
<xsl:variable name="rownumber"><xsl:number level="any" count="productId"/></xsl:variable>
      <gmr:Cell Col="0"  Row="27" ValueType="60">
      <xsl:attribute name="Row">      
         <xsl:value-of select="28 + $rownumber"/>       
      </xsl:attribute>     
       Comments
      </gmr:Cell>

The output is :
1
2
3
4
5
Comments
Comments

This is not what I want.  I need to position similar cells like Comments below the productId cells.  When I try to use the xsl:number to count to get the total number of cells, it will produce the output of text.

I hope you can shed some light on what I did wrong.  Please let me know if I haven't made myself clearer.

THANKS for your time!!!!

Charlene

-----Original Message-----
From: Mike Brown [mailto:mike@xxxxxxxx]
Sent: Tuesday, June 17, 2003 7:36 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] xsl:number problem


Yan, Charlene wrote:
> Maybe my question was not clear enough.  I declared a variable that contains
> the number of productId in the node list.  When I set the Row attribute equal
> to the number, cell and cells after it will do a loop of all the different
> productIds.  This part is working perfectly.  But I want to get the total
> number of productId to position my next cell's position.  Somehow $rownumber
> is only 1 even though the cells loop several times.  How can I do that?  I
> hope I have made myself clearer this time.  Thanks so much for any help!  

You're speaking of cell positions and such, but you have not provided an
example of the output you intend to produce. It is hard for people to advise
you on a good solution under these circumstances. It is possible that the
solution doesn't involve the exact procedure that you're describing above...

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread