xsl-list
[Top] [All Lists]

Re: [xsl] Key and document() problem ?

2008-10-08 05:41:47
 Hello Ken,

Thanks for your reply,

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.

and you don't explain your rationale for error codes.

We can assume they are not there here, they dot not interfere with what I
try to do.

 And 
you don't indicate if you are using XSLT 1 or XSLT 2.  So I'm 
not sure if I can help.
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. Aynway, I saw a simple way to do the thing,
but it is not quite working.
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[(_at_)id=$monitorid]/@timeout > 
        
sum(request/data[(_at_)id=$dataid]/@value)]
<xsl:key name="firstrequest-key" use="concat(../../@id, ../@id)"
match="job/universe/monitor/step/request"/>
                                /request[(_at_)id =
(document($job)/job/universe/monitor[(_at_)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[(_at_)id=$monitorid]/@timeout > 
        
sum(request/data[(_at_)id=$dataid]/@value)]
                                        
                                /request[
                                @id =
(document($job)/job/universe/monitor[(_at_)id=$monitorid]/step[sum($tests/request
[(_at_)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...


Émilise Victor


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>