All right, I am going to throw up the real problem here... and this is
up for grabs, I'll take the first possible solution! Again, I think I
am restricted to XSLT 1.0 (what is the deal with that anyhow? Sorry,
a whole nother topic, but what would it take to start developing again
XSLT 2.0 on a Window 2000+ Server environment?)
Here is what I have so far, I have a match on "record". I use a key
"key_paint" to count my "group a" items and the same key to count my
"groub b" items. Group a and group b items are predifined as part of
the xml source. So, I achieve a unique count of "group a" and "group
b" items and now I need to evaluate the total of these two. In plain
english: "count unique items and then sum the count". (see
additional comments inline below)
<xsl:template match="record">
<xsl:variable name="groupa_count">
!!comment: right here, instead of a select I'd like to wrap this in a
SUM() but not possible... or is it? Using value-of instead doesn't
drive my template match and it is impossible to implement the use of a
mode.
<xsl:apply-templates
select="ancestor::recordset/record[field[(_at_)fieldname='paint']=$luMD_GroupA][generate-id()=generate-id(key('key_paint',field[(_at_)fieldname='paint']))]"
mode="COUNT"/>
</xsl:variable>
<xsl:variable name="groupb_count">
<xsl:apply-templates
select="ancestor::recordset/record[field[(_at_)fieldname='paint']=$luMD_GroupB][generate-id()=generate-id(key('key_paint',field[(_at_)fieldname='paint']))]"
mode="COUNT"/>
</xsl:variable>
</xsl:template>
<xsl:template match="record" mode="COUNT">
<xsl:value-of
select="number(count(ancestor::recordset/record[field[(_at_)fieldname='paint']
= current()/field[(_at_)fieldname='paint']]))"/>
</xsl:template>
On Tue, 29 Mar 2005 10:31:07 -0700, Karl Stubsjoen
<kstubs(_at_)gmail(_dot_)com> wrote:
Not sure if exsl:node-set is supported for .Net, can someone please
verify if this should work in .NET? I am using other EXSLT /
GotDotNet extensions, like the date format extensions.
http://www.exslt.org/exsl/functions/node-set/
On Tue, 29 Mar 2005 10:27:56 -0700, Karl Stubsjoen
<kstubs(_at_)gmail(_dot_)com> wrote:
Hmmm... bit of a dilema in that I am using .NET EXSLT functionality in
development but in production the true parser is MSXML.
So, I guess I am at a bit of a stumbling point unless I can somehow
use either/or functionality based on the environment.
ugggg...
Could I have a base template who's rule for evaluating/aggregating my
variable derive from the MSXML's node-set but for my .NET EXSLT
functionality override this function and also namespace (I guess) in
order to aggregate the variable correctly?
Karl
On Tue, 29 Mar 2005 09:12:26 -0800 (PST), Mukul Gandhi
<mukul_gandhi(_at_)yahoo(_dot_)com> wrote:
but I am faithful there is a very realistic 1.0
solution!
It should be possible with XSLT 1.0.. Possibly you
need to use node-set function also. You can judge from
the solution I posted how relatively easy it is with
XSLT 2.0 .. All the hard work is done by the
processor.
So, let me ask the following question:
Use a variable to store the results of an
apply-templates rule. The
result is a new element which might look something
like this:
<data>
<value>1</value>
<value>1</value>
</data>
How can I aggregate (sum) the above data element
which is stored in a variable?
You would need to use node-set function as..
sum(node-set($temp)/data/value) . XSLT 1.0 does'nt
allow to treat result tree fragments as "node sets"
(but XSLT 2.0 does) ; so in 1.0 we need to convert RTF
to node set using node-set function..
Regards,
Mukul
Karl
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--