Re: [xsl] Grouping

Subject: Re: [xsl] Grouping
From: Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx>
Date: Wed, 7 Dec 2005 10:58:08 +0100
Hi again,

>           I  take back my previous post as I don't see where I am wrong.
> The muenchian grouping is not required for the answers and only for the
> questions that too only if the OP is prticular about it.
>
> Otherwise, my code should work fine.

Yes, your solution would work fine on the input given by the OP (is OP
for Original Poster?). My point was that if the question_id's where
not ordered, then I think that your answer would not work, for
example:

<recordset>
    <row>
       <question_id>1</question_id>
       <answer>1: blah blah blah...</answer>
    </row>
    <row>
       <question_id>2</question_id>
       <answer>2: blah blah blah...</answer>
    </row>
    <row>
       <question_id>1</question_id>
       <answer>3: blah blah blah...</answer>
    </row>
    <row>
       <question_id>2</question_id>
       <answer>4: blah blah blah...</answer>
    </row>
    ...etc...
</recordset>

And now that I think about it, would:
<xsl:value-of select="key('rec', question_id)/answer"/>
not give only the first row/answer element with a given question_id,
no matter the current row element?

As I said, if I am wrong in my assumptions on how the language work, I
would be grateful for clarification.

Regards,
Ragulf Pickaxe :-)

Current Thread