Subject: RE: [xsl] unique-sequence-numbering From: "Sachidanandam E K" <sachidanandam.kumaraswamy@xxxxxxxxxxxxxx> Date: Wed, 7 Aug 2002 18:42:01 +0530 |
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@xxxxxxxxxxxxxx <mailto:sachidanandam.kumaraswamy@xxxxxxxxxxxxxx> -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of subbu@xxxxxxxxxxxx Sent: Wednesday, August 07, 2002 5:30 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] unique-sequence-numbering, Michael Kay | Thread | Re: RE: [xsl] unique-sequence-numbe, subbu |
Re: [xsl] unique-sequence-numbering, Jeff Kenton | Date | Re: RE: [xsl] unique-sequence-numbe, subbu |
Month |