Subject: Re: [xsl] XSLT Hello World - outreach From: David Rudel <fwqhgads@xxxxxxxxx> Date: Fri, 28 Mar 2014 22:27:37 +0100 |
On Fri, Mar 28, 2014 at 10:02 PM, Brian Chrisman <brchrisman@xxxxxxxxx> wrote: > > Okay... is it me, or is this one of those exceedingly rare cases where > you actually want the 'A!=B' test instead of 'not(A=B)'? > ie, test="*[1]/@audience!=*/@audience" would tell us when something in > this case is 'not' to be promoted? > > - Brian It is true that the expression you wrote would do the job, so long as there is at least one child element with an @audience attribute (comparisons are false if either sequence is empty). But I expect most people would prefer boolean(count(distinct-values(*/@audience)) = 1) Note that in some other instance---in particular if you had to do something with the nodes in each case [do one thing if all @audience are the same, and do something else if they are different], you might prefer <xsl:for-each-group select="*" group-by="@audience"> This would allow you to count how many distinct groups you had (by calling last()) and have the nodes already divvied up for processing. -David -- "A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT Hello World - outrea, Brian Chrisman | Thread | Re: [xsl] XSLT Hello World - outrea, David Rudel |
Re: [xsl] Re: Turning escaped mixed, David Carlisle | Date | Re: [xsl] XSLT Hello World - outrea, David Rudel |
Month |