xsl-list
[Top] [All Lists]

Re: anyone can solve it

2003-04-26 03:04:24
Hi,

Warning: this is a newbie answer, but here goes ...

I think you could 1) create a parameter or variable, 2) sort the row elements 
by its year
parameter's value and 3) as you iterate over the row elements, compare the 
value of the immediate
row's year attribute value to the value you previously (or initialized) put 
into the parameter or
variable from step (1) ... depending on the comparison you would write out the 
year and set the
value of your variable/parameter accordingly so you can compare and see when 
the next year comes
along.  You would do all this, of course, probably within the "record" match 
tag (or whatever the
technical name for it is called).

If you were looking for some actual xslt snippet, sorry :)  Hope this helps you 
along on the right
track though.  The rest as I see it is just a matter of syntax, if I'm not 
mistaken.

Nathaniel Stoddard

--- Cheung Tin Po <timothy298(_at_)hotmail(_dot_)com> wrote:
hi expert,

i get an xml file like that
<record>
<row year="2000" month="1" thedata="xyx" />
<row year="2000" month="2" thedata="xyx" />
<row year="2000" month="3" thedata="xyx" />
<row year="2000" month="4" thedata="xyx" />
<row year="2000" month="5" thedata="xyx" />
<row year="2001" month="1" thedata="xyx" />
<row year="2000" month="3" thedata="xyx" />
<row year="2002" month="1" thedata="xyx" />
</record>

i want to use xsl the to trasform the output as html with the following 
result

2000 / 1  : xyx
       2  : xyx
       3  : xyx
2001 / 1  : xyx
       3  : xxx
...
       9  : sss
2002 / 1  : xxx
       2  : xxx


i want the year to show once only...  but i really dont know hoe to do that  
  as i dont know how to remember the value of year in the previous elements

From Timothy






_________________________________________________________________
No masks required! Use MSN Messenger to chat with friends and family. 
http://go.msnserver.com/HK/25382.asp


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



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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



<Prev in Thread] Current Thread [Next in Thread>