I have an xml of the form <data> <row> <col>2003-05-04</col> </row> <row> <col>2003-05-07</col> </row> <row> <col>2003-05-04</col> </row> <row> <col>2003-05-08</col> </row> <row> <col>2004-06-08</col> </row> <row> <col>2004-07-08</col> </row> . . . </data> The col element has dates in the form of yyyy-mm-dd. I am trying to find distinct yyyy-mm values from the above XML in a "variable". I can get distinct date values by using <xsl:variable name="distinctdate" select="//row[not(col=preceding-sibling::row/col)]/col"></xsl:variable> which gives me 2003-05-04 2003-05-07 2003-05-08 2004-06-08 2004-07-08
but what i'd really like is 2003-05 2004-06 2004-07 Any reponses will be greatly appreciated. Thanx
Fudge this rule with the substring function: substring(col, 0, 7) so that you are comparing the first seven chars and not the value of the col element in its entirety. You will have to do some trial and error.
I am leaving the homework for you.
posted 16 years ago
Madhav, Thanx for the suggestion but i can't get the substring'd value. This is what I changed the rule to