Subject: Re: [xsl] Key and document() problem ? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 08 Oct 2008 08:33:17 -0400 |
> You don't explain why you don't have the for-each loop ... Because I want to calculate only one value, taking all steps. I used to have outupts like <site> <step id="1" sum="x" count="x" value="x" /> <step id="2" sum="x" count="x" value="x" /> </site>
Now I need <site sum="x" count="x" value="x" />
That's why the loop isn't there anymore.
I'm not sure myself. My phphinfo gives me 1.1.14 for libxslt and libexslt, 2.6.19 for libxslt compiled against libxml.
So, this morning my head was clear and maybe just writing down my problem helped me understand it better.
Here is my solution :
Couting the steps for wich the test is not over the timeout <xsl:key name="firstrequest-key" use="concat(../../@id, ../@id)" match="job/universe/monitor/step/request"/>
<xsl:variable name="count" select="count(monitor/site/test[
document($job)/job/universe/monitor[@id=$monitorid]/@timeout >
sum(request/data[@id=$dataid]/@value)] <xsl:key name="firstrequest-key" use="concat(../../@id, ../@id)" match="job/universe/monitor/step/request"/> /request[@id = (document($job)/job/universe/monitor[@id=$monitorid]/step/request[generate-i d(.) = generate-id(key('firstrequest-key', concat(../../@id, ../@id))[1])]/@id)])" />
So, this part is ok. Now, I want to know, within the steps I have counted, how much are over their own timeout, that's where I am now. <xsl:variable name="sum" select="count(monitor/site/test[
document($job)/job/universe/monitor[@id=$monitorid]/@timeout >
sum(request/data[@id=$dataid]/@value)]
/request[ @id = (document($job)/job/universe/monitor[@id=$monitorid]/step[sum($tests/request [@id = ./request/@id]/data/@value) > @timeout] /request[generate-id(.) = generate-id(key('firstrequest-key', concat(../../@id, ../@id))[1])]/@id)])" />
The problem here is in that part : @id = ./request/@id. This should point to step/request/@id and I know it doesn't.
Usually, within my for-each loop, I could declare variables containing ids, but here I don't know how to get it...
-- Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Key and document() proble, Emilise Victor | Thread | [xsl] How to substitute a portion o, Paul |
Re: [xsl] XSLT 2: File path to URI , Yves Forkl | Date | RE: [xsl] XSLT 2: File path to URI , Michael Kay |
Month |