Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > loop number and uppercase in xsl

Reply
Thread Tools

loop number and uppercase in xsl

 
 
f
Guest
Posts: n/a
 
      12-01-2003
Here is my xml,

<?xml version = "1.0"?>
<Customer>
<Order Name="Tennis" Quality="10" Time="10/03/03">
<Order Name="Tennis" Quality="1" Time="1/03/03">
<Order Name="Ball" Quality="100" Time="10/3/03">
<Order Name="Tennis" Quality="100" Time="20/03/03">
</Customer>

I'm using xsl
<xsl:for-each select="\Customer\Order">
...
</xsl:for-each>

I want to get something like:

order[0].Name="TENNIS";
order[0].Quality = 10;
order[0].time="10/03/03";

order[1].Name="TENNIS";
order[1].Quality = 100;
order[1].time="1/03/03";

order[2].Name="BALL";
order[2].Quality = 100;
order[2].time="10/3/03";

How can I get the loop number and change the Name to uppercase?


Thanks.

ff
 
Reply With Quote
 
 
 
 
Dimitre Novatchev
Guest
Posts: n/a
 
      12-01-2003

"f" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Here is my xml,
>
> <?xml version = "1.0"?>
> <Customer>
> <Order Name="Tennis" Quality="10" Time="10/03/03">
> <Order Name="Tennis" Quality="1" Time="1/03/03">
> <Order Name="Ball" Quality="100" Time="10/3/03">
> <Order Name="Tennis" Quality="100" Time="20/03/03">
> </Customer>
>
> I'm using xsl
> <xsl:for-each select="\Customer\Order">
> ...
> </xsl:for-each>
>
> I want to get something like:
>
> order[0].Name="TENNIS";
> order[0].Quality = 10;
> order[0].time="10/03/03";
>
> order[1].Name="TENNIS";
> order[1].Quality = 100;
> order[1].time="1/03/03";
>
> order[2].Name="BALL";
> order[2].Quality = 100;
> order[2].time="10/3/03";
>
> How can I get the loop number and change the Name to uppercase?


Both are FAQs:

1. Use the position() function (in your case you have to subtract 1 from
what it returns)

2. Use the translate() function.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
Create a loop that loop for x number of seconds. How ? KingdomHeart Java 0 01-23-2009 12:17 AM
The while loop for calculating a power of a number less than another number? Erik the Red Ruby 4 07-29-2005 08:28 PM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
uppercase in XSLT/XSL-FO Jurrie XML 3 06-30-2004 07:31 AM



Advertisments