[Home] [By Thread] [By Date] [Recent Entries]
Erwin Kloeck wrote:
Hi Erwin, The following is a rough guide and is one way to tackle this. I don't consider it pretty, and for one, you have to replace '1 to 3' with '3' as the number of grouped values (where values are equal). Somehow I couldn't get it right with a simple predicate and xpath, it was a bit late yesterday ;) Of course, you can use grouping, if you find that clearer. The output is close to what you expect. The little details I leave to you. <xsl:template match="logpoint"> <xsl:value-of select="(@value, distinct-values(date/@value))" separator=";"/> <xsl:text> </xsl:text> <xsl:value-of select="for $i in 1 to 3 return (@value, for $val in distinct-values(date/@value) return (';', date[@value = $val][$i]/@string), ' ')" separator="" /> <xsl:text> </xsl:text> </xsl:template> The 'close but not close enough' output by running this against your example input (output method is 'text'): AAA;2007-01-01;2007-01-02;2007-01-03;2007-01-04 AAA;aaa;bbb;ccc;eee AAA;xxx;;ddd; AAA;;;yyy; BBB;2007-01-01;2007-01-02;2007-01-03;2007-01-04 BBB;lll;mmm;nnn;ooo BBB;;;; BBB;;;; The last two 'BBB' should be removed by adjusting the '1 to 3', which is now fixed. Adding a ';' at the end of each line and adding '[@count]' for each value should be easy enough. Cheers, -- Abel Braaksma http://www.nuntia.nl
|

Cart



