[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Keys and select distinct - is that the solution ?
Christian,
If I understand your requirements correctly, solution 1 is nearly there; you just have to add in the facility of de-duplicating your codes before you call the key() function for their names. This could be done either by using a predicate on your select expression (which would filter out all but the first occurrences of values assigned to ManureTypeCollection), or an explicit xsl:if test inside the for-each. Solution 2 relies on the key() function itself to perform the de-duplication of values of ManureTypeCode. Passing a given value to the key() function multiple times is fine, since the resulting set will only have single instances of whatever nodes are returned (the ManureTypeName referred to by that value of ManureTypeCode). I don't see any reason why this shouldn't work just fine here; in fact it's a fairly elegant approach to the problem. Cheers, Wendell once you have deduplicated At 07:01 AM 6/6/2006, you wrote: Hi Wendell, (and others)version="1.0" 01/" 01/">> <xsl:key name="ManureType" match="gr:ManureTypeName" use="../gr:ManureTypeCode"/> <!-- Codes and data --> <eih:ManureTypeCollection> <eih:ManureTypeStructure> <gr:ManureTypeCode>5</gr:ManureTypeCode> <gr:ElementIdentifier>N</gr:ElementIdentifier> <gr:ElementQuantity>17.0</gr:ElementQuantity> </eih:ManureTypeStructure> <eih:ManureTypeStructure> <gr:ManureTypeCode>5</gr:ManureTypeCode> <gr:ElementIdentifier>P</gr:ElementIdentifier> <gr:ElementQuantity>0.6</gr:ElementQuantity> </eih:ManureTypeStructure> <eih:ManureTypeStructure> <gr:ManureTypeCode>4</gr:ManureTypeCode> <gr:ElementIdentifier>N</gr:ElementIdentifier> <gr:ElementQuantity>17.5</gr:ElementQuantity> </eih:ManureTypeStructure> <eih:ManureTypeStructure> <gr:ManureTypeCode>4</gr:ManureTypeCode> <gr:ElementIdentifier>P</gr:ElementIdentifier> <gr:ElementQuantity> 6.3</gr:ElementQuantity> </eih:ManureTypeStructure> <eih:ManureTypeStructure> <gr:ManureTypeCode>3</gr:ManureTypeCode> <gr:ElementIdentifier>N</gr:ElementIdentifier> <gr:ElementQuantity> 65.3</gr:ElementQuantity> </eih:ManureTypeStructure> <eih:ManureTypeStructure> <gr:ManureTypeCode>3</gr:ManureTypeCode> <gr:ElementIdentifier>P</gr:ElementIdentifier> <gr:ElementQuantity> 26.3</gr:ElementQuantity> </eih:ManureTypeStructure> <eih:ManureTypeStructure> <gr:ManureTypeCode>3</gr:ManureTypeCode> <gr:ElementIdentifier>P</gr:ElementIdentifier> <gr:ElementQuantity> 16.3</gr:ElementQuantity> </eih:ManureTypeStructure> </eih:ManureTypeCollection>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|