W3C home > Mailing lists > Public > xproc-dev@w3.org > May 2011

RE: Having trouble getting a max( ) value

From: <vojtech.toman@emc.com>
Date: Fri, 20 May 2011 07:50:43 -0400
To: <xproc-dev@w3.org>
Message-ID: <3799D0FD120AD940B731A37E36DAF3FE33D55A8E9B@MX20A.corp.emc.com>
Alex,

To answer your second question first, p:variable must always precede all step in the sub-pipeline. In your case, p:variable cannot follow p:load.
This may be also related to your main problem, that you get an empty string as the result of the max() function. First, your example (p:group followed directly by p:variable) is not legal for the same reasons as above. If for some reason Calabash does not reject this (which it should), then my bet is that an empty document is used as the context for p:variable, which would explain the empty string result.

Vojtech


--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On Behalf Of Alex Muir
Sent: Friday, May 20, 2011 1:38 PM
To: XProc Dev
Subject: Having trouble getting a max( ) value

Hi,

So I want to start off a pipeline by getting a maximum value to use later on in the process via the following max(//page/id) which works in oxygen as an xpath on the input file returning a value around 15000. I've verified the correct input file is loading. In the following code however the value returned is a zero length string. So what am I doing wrong?

 <p:group name="extractMaxID">

    <p:load>
      <p:with-option name="href" select="$hrefFullWikiDumpInputToGetMaxIDValue"/>
    </p:load>

  </p:group>

  <p:variable name="MaxID" select="max(//page/id)"/>  // is returning a zero length string


Secondly when I put the variable within the p:group I get the following error using Oxygen XML Editor 12.1, build 2011011116

E [Calabash XProc] Unexpected step name: p:variableUnexpected step name: p:variable.

<p:group name="extractMaxID">

    <p:load>
      <p:with-option name="href" select="$hrefFullWikiDumpInputToGetMaxIDValue"/>
    </p:load>
   <p:variable name="MaxID" select="max(//page/id)"/>

</p:group>

Is that normal? (hmm..I almost recall this may have already been talked about on the list, sorry if that's the case)


Regards

--
Alex Muir
Instructor
Program Organizer
University Technology Student Work Experience Building
https://sites.google.com/a/utg.edu.gm/utsweb/
+220 359 1203
Received on Friday, 20 May 2011 11:51:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 20 May 2011 11:51:25 GMT