This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: unique-sequence-numbering
- From: "Sachidanandam E K" <sachidanandam dot kumaraswamy at kla-tencor dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 7 Aug 2002 18:42:01 +0530
- Subject: RE: [xsl] unique-sequence-numbering
- Reply-to: xsl-list at lists dot mulberrytech dot com
Always post if soultion is not found in XSL Archives.
http://www.jenitennison.com/xslt/number.html
Check here.Jeni's solutions is always there .
Also there is answers posted of this kind of Q's already found in XSL list
arcvies.
Sachidanandam.E.K
Member Techinical Staff
HCLT KT-ODC
sachidanandam.kumaraswamy@kla-tencor.com
<mailto:sachidanandam.kumaraswamy@kla-tencor.com>
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
subbu@boltblue.com
Sent: Wednesday, August 07, 2002 5:30 PM
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] unique-sequence-numbering
Sorry for reposting..The subject was wrong!!
i have an xml file which looks like below.
<?xml version="1.0"?>
<students>
<student id = "101">
<name>A</name>
<address>XXX</address>
</student>
<student id = "201">
<name>B</name>
<address>YYY</address>
</student>
<student id = "301">
<name>C</name>
<address>XXX</address>
</student>
<student id = "401">
<name>E</name>
<address>YYY<address>
</student>
</students>
And i have to deliver a CSV file that has the following fields.
Student-id , SequenceNumber , name, address.
Sequence number is an automatically generated number ( should start from 1
to
end of Students )..
so a typical CSV FIle would be..
101,1,A,abc
102,2,B,bcd
103,3,C,cde
104,4,D,efg
..
Now There is a business rule that says that if a student has an address
value
that is equal to 'YYY', then show the complete information *line* twice,
with
only the sequence number changed..
That is
101,1,A,abc
102,2,B,bcd
102,3,B,bcd <-- repeated again with sequence number changed
103,4,C,cde
104,5,D,efg
104,6,D,efg <-- repeated again with sequence number changed
I am using the position() function to get the serial number..This is where
the
problem starts..
If i put a condition that
if address == 'YYY' ( just pseudo code. dont mind the syntax )
{
value-of-select --> @id,position(),name,address
@id,position()+1,name,address
}
else
{
value-of-select --> @id,position(),name,address
}
I end up getting something like this
101,1,A,abc
102,2,B,bcd
102,3,B,bcd <-- repeated again with sequence number changed
103,3,C,cde <-- same sequence number repeated... That is the position ..
104,4,D,efg
104,5,D,efg <-- repeated again with sequence number changed
and what i want should look like
101,1,A,abc
102,2,B,bcd
102,3,B,bcd <-- repeated again with sequence number changed
103,4,C,cde <-- this is not showing up position but prev-seq+1
104,5,D,efg
104,6,D,efg <-- repeated again with sequence number changed
so the requirement tells, if you find address equal to 'YYY', then add it
show
it once more with a sequence number -> prev-seq-num +1 and then every
subsequent sequence number should be consequitive. The sequence number is a
unique number ( from 1 to End of students ).
I can not think of a way to do this.This looks totally like a dead end to
me.
I shall be highly thankful if some one can please help me out of this
situation...
Please let me know if i am missing out any information that would make the
question clearer..
Thanks a ton!!!!!!!!!
--------------------------------------------------------------
Sent with "Me-Mail", Boltblue's FREE mobile messaging service.
http://www.boltblue.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list