- From: Alex Miłowski <alex@milowski.com>
- Date: Fri, 12 Feb 2016 16:01:48 +0100
- To: XProc WG <public-xml-processing-model-wg@w3.org>
One of the risks we have is that the use of XPath as an expression language makes XProc difficult for non-XML environments where no such implementation exists. We have several uses of XPath: 1. Projections (e.g., $in//section) 2. replace ($in//section) { ...} 3. variables 4. conditionals For (1) we make projects a step specific to the data format. For (2) ... not sure. For (3): variables are output port variables and we dump let. You need to use a step to do manipulations. We need to make embedding steps or mapping them to implementations possible. For (4): I think we can get rid of the expression language by enhancing the step description so the expressions can be put into a step as its implementation and the step gets used in a flow. So, we currently have this: if (xs:decimal($1/*/@version) < 2.0) then [$1,"v1schema.xsd"] → validate-with-xml-schema() ≫ @1 else [$1,"v2schema.xsd"] → validate-with-xml-schema() ≫ @1 we would now have: step check-version1() inputs $source as document-node() outputs $result as xs:boolean from "my:check-version1" in "script.xq"; $1 → check-version1() ≫ $isv1 if ($isv1) then [$1,"v1schema.xsd"] → validate-with-xml-schema() ≫ @1 else [$1,"v2schema.xsd"] → validate-with-xml-schema() ≫ @1 and "script.xq" is: function my:check-version1($source) as xs:boolean { return xs:decimal($1/*/@version) < 2.0 d } Now, this is now two files instead of one. We can fix this by allowing embedding of the script. It is unclear how the parsing would work: step check-version1() inputs $source as document-node() outputs $result as xs:boolean script "application/xquery" { return xs:decimal($1/*/@version) < 2.0 d } Also, when there is more than one output port, the return will be more complicated and need to be a map. In other languages, it will be a similar construct. We probably want simple literal comparisons to enable steps to return emulated values that then control which flow is executed. -- --Alex Miłowski "The excellence of grammar as a guide is proportional to the paucity of the inflexions, i.e. to the degree of analysis effected by the language considered." Bertrand Russell in a footnote of Principles of Mathematics
Received on Friday, 12 February 2016 15:02:21 UTC