Re: [xsl] Grouping

Subject: Re: [xsl] Grouping
From: omprakash.v@xxxxxxxxxxxxx
Date: Wed, 7 Dec 2005 15:47:30 +0530
Hi,

"<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?"

Yes. Looks like Iam missing an xpath index in my expression. something like
the following and I would have been right ofcourse.

<xsl:value-of select="key('rec', question_id)[x]/answer"/>

where x is the current row in question(no pun intended).

But ofcourse that would mean having a recursive template to keep track of
the current row etc. which makes a solution using key less preferable in
this case I think.

Thanks for pointing out my error.

cheers,
prakash









                                                                                                                                       
                      Ragulf Pickaxe                                                                                                   
                      <ragulf.pickaxe@         To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                                
                      gmail.com>               cc:      (bcc: omprakash.v/Polaris)                                                     
                                               Subject: Re: [xsl] Grouping                                                             
                      12/07/2005 03:28                                                                                                 
                      PM                                                                                                               
                      Please respond                                                                                                   
                      to xsl-list                                                                                                      
                                                                                                                                       
                                                                                                                                       




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 :-)





This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread