Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 27th, 2008, 01:52 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
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>
Reply With Quote
  #2 (permalink)  
Old March 27th, 2008, 04:57 PM
Friend of Wrox
Points: 1,676, Level: 16
Points: 1,676, Level: 16 Points: 1,676, Level: 16 Points: 1,676, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2006
Location: , , .
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.



Reply With Quote
  #3 (permalink)  
Old March 31st, 2008, 09:57 AM
Registered User
 
Join Date: Mar 2008
Location: , , .
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.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 09: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 01:22 PM



All times are GMT -4. The time now is 03:20 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.