my formula is as follows;
<xsl:value-of select="count(//dsQueryResponse/Rows/Row/@DueDate[not(dsQueryResponse/Rows/Row/@DueDate=preceding::dsQueryResponse/Rows/Row/@DueDate)])"/>
________________________________
From: knoxcameron <kcameron@kpmg.com.au>
To: sharepointdiscussions@yahoogroups.com
Sent: Monday, November 17, 2008 9:52:15 PM
Subject: [sharepointdiscussions] Re:convert excel formula to xsl for use in data form web part
One of my xslt texts has a simpler technique. They have the example
of a set of city elements with a country attribute. To count the
number of distinct countries, they build a node-set of the cities
whose country does not match any preceding country, and count the
number of elements of that:
<xsl:value-of select="count( //city[not
(@country=preceding ::city/@country) ]"/>
Performance might be an issue with a large data set, but should be
OK for most SharePoint list situations.
--- In sharepointdiscussio ns@yahoogroups. com, Rainer Wittmann
<R.Wittmann@ ...> wrote:
>
> No easy way at all, but still doable.
>
> Look for Munchian group algorithm, best described by Jeni Tennison
> http://www.jenitenn ison.com/ xslt/grouping/ index.html
>
> In a nutshell:
> You want to group and count an attribute @attribute which is part
of an ROW element.
>
> Step 1: Set up a key: <xsl:key name="Rows-by- attr" match="Row"
use="@attribute" />
>
> Step 2: Create a template with mode attr-group.
>
> <xsl:template match="Row" mode="attr-group" >
> <xsl:value-of select="@attribute" />
> (<xsl:value- of select="count( key(' Rows-by-attr, @attribute)) " />)
> </xsl:template>
>
> Step 3: Wherever you are interested in the result apply the
template from step 2:
>
> <xsl:apply-template s mode="attr-group" select="Row[ generate- id(.)
= generate-id( key(Rows- by-attr ', @attribute)[ 1])]"> <xsl:sort
select="@attribute" />
> </xsl:apply- templates>
>
> Step 4: Find out what did go wrong when you implemented 1-3, which
is the hardest part at all.
>
>
> Good luck
>
>
> Rainer
>
>
> -----Original Message-----
> From: sharepointdiscussio ns@yahoogroups. com
[mailto:sharepointdiscussio ns@yahoogroups. com] On Behalf Of Jay
Strickland
> Sent: Montag, 17. November 2008 18:45
> To: sharepointdiscussio ns@yahoogroups. com
> Subject: Re: [sharepointdiscussi ons] Re:convert excel formula to
xsl for use in data form web part
>
> XSLT 2.0 supports the "distinct-values" operator, but SharePoint,
or more specifically SPD, does not. I have been searching and so
far the only answer I have seen is "counting is the same as sorting
is the same as grouping." No, it really isn't. (None of the sample
solutions are really helpful, and most don't work at all.) I would
have thought that counting values but excluding repeat occurrences
of the value would be failrly easy. Sadly I am mistaken. If anyone
has any ideas on how to simply count how many entries are in a
column, excluding duplicates, I would love to know.
>
>
>
>
> ____________ _________ _________ __
> From: Dick Penny <d_penny@... >
> To: sharepointdiscussio ns@yahoogroups. com
> Sent: Friday, November 14, 2008 3:33:22 PM
> Subject: [sharepointdiscussi ons] Re:convert excel formula to xsl
for use in data form web part
>
>
> I don't have an exact answer, BUT, I've seen some XSLT recipes
somewhere and
> thought one of them was "counting distinct items." Try the W3..org
site. Or
> google "XSLT recipes".
>
> Dick Penny
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
> ------------ --------- --------- ------
>
> Yahoo! Groups Links
>
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sharepointdiscussions/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/sharepointdiscussions/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:sharepointdiscussions-digest@yahoogroups.com
mailto:sharepointdiscussions-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
sharepointdiscussions-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/


0 comments:
Post a Comment