- From: <vojtech.toman@emc.com>
- Date: Fri, 20 May 2011 08:23:07 -0400
- To: <xproc-dev@w3.org>
- Message-ID: <3799D0FD120AD940B731A37E36DAF3FE33D55A8EB4@MX20A.corp.emc.com>
Alex, I am not sure I follow, but the rule is that p:variable must always precede the steps in the sub-pipeline. This to avoid ordering/visibility paradoxes in the sub-pipeline in XProc V1. You previous example with p:load can be fixed quite easily: <p:group> <p:load> <p:with-option name="href" select="..."/> </p:load> <p:group> <p:variable name="MaxID" select="..."/> ... do something with $MaxID </p:group> ... </p:group> Basically, you wrap the p:variable in a new sub-pipeline. (The potential disadvantage of this that MaxID will not be visible outside of the nested p:group, so if you need to pass the value further, you will need to make sure that the nested p:group returns the value of MaxID on one of its output ports.) Vojtech From: Alex Muir [mailto:alex.g.muir@gmail.com] Sent: Friday, May 20, 2011 2:14 PM To: Toman, Vojtech Cc: xproc-dev@w3.org Subject: Re: Having trouble getting a max( ) value Vojtech, Okay,, thanks,, what is the benefit to restrict p:variables in this way? I'm confused now because in one of my templates I declare the following to grab some processing time info that is stored within the xml. I declare this near the end of my process and it works fine with the latest version of calabash, although I haven't run that pipeline in Oxygen. From your statements I gather this should not be working.. Is this different somehow? <p:group name="TimeToProcessOutput"> <p:variable name="minutes" select="//processing/@minutes"/> <p:variable name="seconds" select="//processing/@seconds"/> <cx:message> <p:with-option name="message" select="concat('§§§ TIME TO PROCESS Minutes: ',$minutes,' Seconds: ',$seconds)"/> </cx:message> </p:group> I basically have to load a document that I'm only using to get the max value and then load a different document to process further. A solution is to load the doc in xslt and get the max value directly but I'd rather extract the value in xproc and pass it within a parameter. How do I do that in xproc? Thanks Alex On Fri, May 20, 2011 at 11:50 AM, <vojtech.toman@emc.com<mailto:vojtech.toman@emc.com>> wrote: 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<mailto:vojtech.toman@emc.com> http://developer.emc.com/xmltech From: xproc-dev-request@w3.org<mailto:xproc-dev-request@w3.org> [mailto: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<tel:%2B220%20359%201203> -- 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 12:25:20 UTC