[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xsl:number problem
Rob, Thanks for the direction. My output should look like this: 1 2 3 4 5 Comments If I use the current code, the output is 1 2 3 4 5 Comments Comments I tried to change the value of Row attribute to <xsl:valueOf select="last()-1"/>. The output is 1 2 3 4 5 Comments The Comments cell is way down to the nottom of the page (around 100 rows in between). I think that the key to solve my problem is to find the TOTAL NUMBER of productId in my xml tree. How can you do that? Please find the xml below. product is at the different levels of the node tree. I need to find out the total number of times it is in the xml tree. xsl:number is not a good way to return a total number. It seems to be just looping through the tree. Can count(productId) be used here??? THANKS!!! Charlene -----Original Message----- From: Rob Anderson [mailto:roba@xxxxxxxxxx] Sent: Wednesday, June 18, 2003 9:22 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: xsl:number problem try using ...position () = last() - 1...? or can you show an example of what you are expecting -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Yan, Charlene Sent: 18 June 2003 14:10 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: xsl:number problem 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: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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|