Subject: RE: [xsl] for-each-group From: Ryan Puddephatt <rpuddephatt@xxxxxxxxxxxx> Date: Mon, 12 Dec 2005 17:33:10 +0000 |
You could use a function in the group-by, this would allow you to test the value of the current record (.) for 'Internal' then return an <xsl:sequence select="'internal'/> or <xsl:sequence select="'else'"/> XSL will then group them and display them as you want, of course if you only have two values in sortColumn1 (i.e. Internal or External) then just pass group-by the sortColumn1 and it will group them! Ryan Puddephatt Web Developer TFX Group 1 Michaelson Square Livingston West Lothian Scotand EH54 7DP * rpuddephatt@xxxxxxxxxxxx ( 01506 407 110 7 01506 407 108 -----Original Message----- From: thomas.maciejewski@xxxxxxxxx [mailto:thomas.maciejewski@xxxxxxxxx] Sent: 12 December 2005 17:27 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] for-each-group I am having a problem with for-each-group and it may be because I just dont understand it. (Hopefully I dont get flamed ;-) ) What I want to do is to create a set of groups based on a condition. like "foo='Internal' is that allowed? what i have been trying is : <xsl:for-each-group select=" xmlReportOutput/reportOutput/records/record" group-by=" saxon:evaluate($sortColumn1)!='Internal'"> <!--<xsl:for-each-group select="current-group()" group-by="saxon:evaluate($sortColumn1)">--> <xsl:sort select="saxon:evaluate($sortColumn1)" order=" {$sortColumn1Order}"/> <xsl:variable name="group1" select=" current-grouping-key()"/> <xsl:call-template name="RenderByDesk"> <xsl:with-param name="tradeType" select="$group1"/> </xsl:call-template> </xsl:for-each-group> But everything I try either produces no groups or fails and tells me my group-by. Originally I was not doing the != Internal and it seemed to work grouping by the saxon:evaluate($sortColumn1) field. Ahh do I need to get the value of that field? Error in Xpath 2.0 expression Unknown function Name and number of arguments do not match any function. Can someone please give me a few pointers on for-each and for-each-group ? I think I need to use the group one as later on I pass each group on to a different template: <xsl:template name="RenderByDesk"> <xsl:param name="tradeType"/> <xsl:for-each-group select="current-group()" group-by=" saxon:evaluate($sortColumn2)"> <xsl:sort select="saxon:evaluate($sortColumn2)" order=" {$sortColumn2Order}"/> <xsl:variable name="group2" select=" current-grouping-key()"/> <xsl:call-template name="RenderByCounterPartyRole"> <xsl:with-param name="tradeType" select="$tradeType "/> <xsl:with-param name="desk" select="$group2"/> </xsl:call-template> </xsl:for-each-group> </xsl:template> Tom Maciejewski ************************************************************************* This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. *************************************************************************
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] for-each-group, thomas . maciejewski | Thread | Re: [xsl] for-each-group, David Carlisle |
[xsl] for-each-group, thomas . maciejewski | Date | Re: [xsl] for-each-group, David Carlisle |
Month |