loop number and uppercase in xsl

F

f

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
 
D

Dimitre Novatchev

f said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top