XSLT for-each select syntax

I've inherited a gross xslt project - I can't figure out how this line of code reads

<xsl:for-each select="*[local-name()='CustomerOrderLine'][count(. | key('orderline-by-ShipAddress', *[local-name()='CustomerOrderPostalAddresses']/*[local-name()='CustomerOrderPostalAddress']/*[local-name()='PostalAddress']/*[local-name()='Line3'])[1]) = 1]">

I understand that this for-each is selecting 'CustomerOrderLine' nodes based off something to do with the 'orderline-by-ShipAddress' key and some kind of union between it and the current node.

I'm looking to understand how this code "reads" so I can better understand how it's working and what I'll need to change in order to re-use the technique.

Answers


Read about Muenchian grouping here: http://www.jenitennison.com/xslt/grouping/muenchian.xml. It is used together with an xsl:key to group and identify the first item in each group. So that for-each processes the first CustomerOrderLine in each group where the grouping is based on the value of the Line3 descendant.


This looks like Grouping Using the Muenchian Method

Basically it is a way to group elements.


Need Your Help

sectionNameKeyPath through multiple relationships

iphone cocoa-touch core-data ios nsfetchedresultscontroller

I am working on an app that uses Core Data and an NSFetchedResultsController. The model setup is like this:

Accelerator Sensor orientation with AndEngine

java android andengine

I am using Andengine and using SenorEvents to make a sprite move with the accelerometer.