Re: [xsl] Keys with duplicates should be simple

Subject: Re: [xsl] Keys with duplicates should be simple
From: Eliot Kimber <ekimber@xxxxxxxxxx>
Date: Fri, 31 Jan 2014 11:19:01 -0600
I love except.

Cheers,

E.
--
Eliot Kimber
Senior Solutions Architect
+ACI-Bringing Strategy, Content, and Technology Together+ACI-
Main: 512.554.9368
www.reallysi.com
www.rsuitecms.com




On 1/31/14, 11:16 AM, +ACI-Wendell Piez+ACI-
+ADw-wapiez+AEA-wendellpiez.com+AD4- wrote:

+AD4-Hi,
+AD4-
+AD4-I think the big difference here is the scope of inspection of 'a'
+AD4-children.
+AD4-
+AD4APA-xsl:copy-of
select+AD0AIg-a+AFs-key('person',+AEA-href)+AFs-2+AF0AXQAi-/+AD4-
+AD4-
+AD4-Copies 'a' children as long as there is more than one node +ACo-anywhere
+AD4-in the document+ACo- returned by the key for the a/+AEA-href.
+AD4-
+AD4-It works like the exists() test because the effective Boolean value
+AD4-for a sequence of nodes is true(), while for an empty sequence it's
+AD4-false(). This corresponds the XPath 1.0 rule for coercing node sets to
+AD4-Booleans, wherein (only) empty node sets become false().
+AD4-
+AD4-Gerrit's suggestion using grouping (which I prefer) restricts the test
+AD4-to duplicates among the 'a' element children of the parent being
+AD4-matched.
+AD4-
+AD4-For this, one could also say
+AD4-
+AD4-a+AFsAQA-href +AD0- (../a except .)/+AEA-href+AF0-
+AD4-
+AD4-... but we all know no one likes 'except' (except me) ... so the
+AD4-grouping solution is less apt to mystify.
+AD4-
+AD4-If one didn't want to see the first instance, only its duplicate(s),
then
+AD4-
+AD4-a+AFsAQA-href +AD0- preceding-sibling::a/+AEA-href+AF0-
+AD4-
+AD4-Cheers, Wendell
+AD4-
+AD4-
+AD4-On Fri, Jan 31, 2014 at 2:22 AM, Ihe Onwuka
+ADw-ihe.onwuka+AEA-gmail.com+AD4- wrote:
+AD4APg- No +AFs-2+AF0- means that a 2nd one exists which would be true if a
3rd one
+AD4APg-existed etc.
+AD4APg-
+AD4APg- The full dataset picks up instances where there is more than one
+AD4APg- duplicate so I can verify the above interpretation.
+AD4APg-
+AD4APg- Having said that your offering although more verbose is superior
+AD4APg- semantically as really the best way to write this is something like
+AD4APg- (and I am pleading the fifth on the syntax here)
+AD4APg- exists(key('person',+AEA-href)+AFs-2+AF0-) but then you look at that
and you
+AD4APg- realise or can argue (I think) that what I wrote is an abbreviated
+AD4APg- form of that anyway.
+AD4APg-
+AD4APg- I suppose a guru could tell whether they are semantically identical
+AD4APg- and whether the one abbreviates the other.
+AD4APg-
+AD4APg- On Fri, Jan 31, 2014 at 12:45 AM, Graydon
+ADw-graydon+AEA-marost.ca+AD4- wrote:
+AD4APgA+- On Thu, Jan 30, 2014 at 04:38:49PM -0800, Dimitre Novatchev
scripsit:
+AD4APgA+AD4- +ADw-xsl:key name+AD0AIg-person+ACI- match+AD0AIg-a+ACI-
use+AD0AIgBA-href+ACI-/+AD4-
+AD4APgA+AD4-    +ADw-xsl:template match+AD0AIg-person+ACIAPg-
+AD4APgA+AD4-      +ADw-duplicate+AD4-
+AD4APgA+AD4-        +ADw-xsl:copy-of
select+AD0AIg-a+AFs-key('person',+AEA-href)+AFs-2+AF0AXQAi-/+AD4-
+AD4APgA+AD4-      +ADw-/duplicate+AD4-
+AD4APgA+AD4-    +ADw-/xsl:template+AD4-
+AD4APgA+AD4- +ADw-/xsl:stylesheet+AD4-
+AD4APgA+-
+AD4APgA+- Can I note that the +AFs-2+AF0- would appear to suppose that
there's only ever
+AD4APgA+- one duplicate?
+AD4APgA+-
+AD4APgA+- not(position() eq 1) is likely safer.
+AD4APgA+-
+AD4APgA+- -- Graydon
+AD4APgA+-
+AD4APgA+-
--+AH4-------------------------------------------------------------------
+AD4APgA+- XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
+AD4APgA+- To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
+AD4APgA+- or e-mail:
+ADw-mailto:xsl-list-unsubscribe+AEA-lists.mulberrytech.com+AD4-
+AD4APgA+- --+AH4---
+AD4APgA+-
+AD4APg-
+AD4APg-
--+AH4-------------------------------------------------------------------
+AD4APg- XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
+AD4APg- To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
+AD4APg- or e-mail:
+ADw-mailto:xsl-list-unsubscribe+AEA-lists.mulberrytech.com+AD4-
+AD4APg- --+AH4---
+AD4APg-
+AD4-
+AD4-
+AD4-
+AD4---
+AD4-Wendell Piez +AHw- http://www.wendellpiez.com
+AD4-XML +AHw- XSLT +AHw- electronic publishing
+AD4-Eat Your Vegetables
+AD4AXwBfAF8AXwBf-oo+AF8AXwBfAF8AXwBfAF8AXwBf-o+AF8-o+AF8AXwBf-ooooo+AF8AXwBf
AF8-ooooooo+AF8AXg-
+AD4-
+AD4---+AH4------------------------------------------------------------------
-
+AD4-XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
+AD4-To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
+AD4-or e-mail:
+ADw-mailto:xsl-list-unsubscribe+AEA-lists.mulberrytech.com+AD4-
+AD4---+AH4---
+AD4-

Current Thread