[xsl] Key and document() problem ?

Subject: [xsl] Key and document() problem ?
From: "Emilise Victor" <evictor@xxxxxxxxxxxx>
Date: Tue, 7 Oct 2008 17:43:30 +0200
Hello,

I would like to construct a key based on a different document, but I saw that
is was not going to work. So I'm going explain what I want to do, since now I
have no idea how it could be done.
Here are two pieces of the document I'm working on :

<job>
  <universe>
    <monitor id="45995" timeout="10000">
      <step id="1" timeout="4000">
        <request id="1"/>
      </step>
      <step id="2"timeout="9000">
        <request id="2"/>
        <request id="3"/>
      </step>
	 </monitor>
	</universe>
</job>

And

<monitor id="45995">
	<site>
		<test id="36">
			<request id="1">
				<data id="4" value="2394"/>
			</request>
			<request id="2">
				<data id="4" value="1969"/>
			</request>
			<request id="3">
				<data id="4" value="5451"/>
			</request>
		</test>
	</site
</monitor>

The whole thing is about selecting the requests of the 2nd document according
to their step in the first document. So, usually it was easy since I had a
for-each loop for the steps. The "step" level was so preserved. ie, I
calculate the sum of request/data/@value in each step. That would be 2394 for
step 1 and 1969+5451 for step2.
Now my problem is that I don't have the for-each step loop, but I still have
to sum request according to the step they are in.
Here is the beginning of what I want to do :
<xsl:variable name="count" select="count(monitor/site/test[
				request
				and not(request/@errorcode)
				and not(request/@errortype)
				and document($job)/job/universe/monitor[@id=$monitorid]/@timeout >
					sum(request/data[@id=$dataid]/@value)])" /> This variable has the number
of tests for wich the sum of request/data/@value is < to the timeout from the
first document. Now, for these tests, I want to know, for each step, if the
sum of request/data/@value (request being in the step) is also < to the step
timeout.
To begin with, I would like to know something like :
<xsl:variable name="count" select="count(monitor/site/test[
				request
				and not(request/@errorcode)
				and not(request/@errortype)
				and document($job)/job/universe/monitor[@id=$monitorid]/@timeout >
					sum(request/data[@id=$dataid]/@value)]

				/request[@id = (first id of a step))" />

I don't know if it's clear. I don't even see clearly myself how I could
achieve this. Let me know if I can add details. My scripts are working under
PHP5

Tanks for any advice...


Imilise Victor

Current Thread