Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 27th, 2008, 12:52 PM
Registered User
 
Join Date: Mar 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT simulation of two column Group By

In my transformation using 1.0, I am getting the appropirate output with one exception - I need to simulate a Group By on two coulmns (attributes) of my output. Currently my output is giving me 30 child elements, and it should group down to 2 child elements - To_Currency and From_Currency. How do I simulate this in XSLT? Following is my code:

<xsl:element name="MAX_DATES">


<xsl:for-each select="FOREX[@FROM_CURRENCY='USD'] | FOREX[@FROM_CURRENCY='USD DOL']">


<xsl:variable name="strPriceDate" select="normalize-space(@PRICE_DATE)"/>

<xsl:variable name="strToCurrency" select="normalize-space(@TO_CURRENCY)"/>
<xsl:variable name="strFromCurrency" select="normalize-space(@FROM_CURRENCY)"/>

<xsl:variable name="strMaxDate">
<xsl:for-each select="//FOREX[@FROM_CURRENCY='USD'] | //FOREX[@FROM_CURRENCY='USD DOL']">

<xsl:sort select="@PRICE_DATE" data-type="text" order="descending" />
<xsl:if test="position()=1">

<xsl:value-of select="@PRICE_DATE"/>
</xsl:if>

</xsl:for-each>
</xsl:variable>







<xsl:element name="MAX_DATE">



<xsl:attribute name="FROM_CURRENCY">

<xsl:value-of select="@FROM_CURRENCY" />
</xsl:attribute>


<xsl:attribute name="TO_CURRENCY">

<xsl:value-of select="@TO_CURRENCY" />
</xsl:attribute>


<xsl:attribute name="MAX_PRICE_DATE">

<xsl:value-of select="$strMaxDate" />
</xsl:attribute>

</xsl:element>
</xsl:for-each>

</xsl:element>
 
Old March 27th, 2008, 03:57 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Wes,

Check your post at asp.net. I answered it there. Try not to make duplicate postings on different sites.



 
Old March 31st, 2008, 08:57 AM
Registered User
 
Join Date: Mar 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Bonekrusher:

Thanks for your response here. I am a native asp.net programmer and have used the forums at asp.net for years. My experience in the last few months is that might not be the best site for XSLT based posts. Not sure if that is true or not but that is why I am posting on different sites - I am trying to find the best forums for XSLT based questions.

Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to group xsl elements in xslt.10 suji XSLT 1 February 29th, 2008 03:44 AM
Sum a column at the group level? srussell705 SharePoint Development 0 October 3rd, 2007 08:40 AM
group by: display different column lethe SQL Language 3 February 16th, 2007 12:54 PM
Chat simulation ahardin59 ASP.NET 2.0 Basics 0 June 26th, 2006 12:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.