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 June 15th, 2010, 09:47 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default

Hi Martin,

I have tried your xslt and it works fine.

I would like to express my sincere thanks for your help and source code.

Please could you explain to us the key you created?

<xsl:key name="k1" match="Ad" use="concat(ancestor::Vehicle/@key, '|', Position/@name)"/>

1 - Why are you using concat to create a key with two values i.e. vehicle key and position name?

2 - how did you realise that it was necessary to have a concat for the key?

It was trying to group using only Position/@name so I would never have got it right :-(

Cheers
 
Old June 15th, 2010, 11:14 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

As far as I understand your sample input and output you want to group the "Ad" elements for each "Vehicle" (respectively for each "Vehicle/@key") that is why it is necessary to use a key value that concatenates the "key" attribute value with the "name" attribute value. If we defined the key only on the "Position/@name" attribute value we would get groups containing "Ad" elements of different "Vehicle" ancestors.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old June 15th, 2010, 01:41 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default

Hi Martin,

Thanks for the explanation.

It is spot on.





Similar Threads
Thread Thread Starter Forum Replies Last Post
SSRS 2005 Matrix Totals Problem!!!!!!!!!!!!!!!!! dba123 Reporting Services 1 February 10th, 2006 10:00 AM
Grouping problem aware Access 11 August 4th, 2005 11:00 AM
Grouping and totals btado XML 4 July 1st, 2005 03:08 AM
Grouping and totals btado XSLT 3 June 22nd, 2005 01:08 AM





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