[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Key and document() problem ?

Subject: Re: Key and document() problem ?
From: "Emilise Victor" <evictor@xxxxxxxxxxxx>
Date: Wed, 8 Oct 2008 11:42:52 +0200
Re:  Key and document() problem ?
 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[@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...


Imilise Victor

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.