Project

General

Profile

Feature #5013

Updated by Reynaud Sylvain over 10 years ago

+Refactoring steps+: 
 1) develop java class to invoke make all <processor> for all SELECTED and DESCENDANT_OF_SELECT events. extends <code>AbstractSAXPathProcessor</code>. 
 2) support new syntax: 

  * develop XSL to translate new syntax to current syntax (for pre-processing). 
  * develop XSL to translate current syntax to new syntax (for lavoisier-update-config.sh). 

 3) support Lavoisier XPath functions in PiXTL short notation (modify XSL to translate PiXTL short notation to new syntax). 
 4) support new syntax hidden parameters 

  * modify XSL to generate hidden parameters. 
  * instanciate plug-in from new syntax. 

 5) refactoring: move AbstractSAXPathProcessor to engine: 

  * modify adaptor interfaces. 
  * modify engine. 


 +Language modifications+: 
 * replace parameter "nodes" with attribute @match. 
 * replace parameter "namespaces" with xmlns:ns. 
 * replace parameters "variables" and "xml_variables" with <variable isXML="true|FALSE"/>. 
 * support all XPath functions in both context, except function matched(). 

 +Pre-processing steps+: 
 1) convert XPath to XML tree <eval>. 
 2) optimize: 

 * move the XPath functions that have no descendant::RelativeLocationPath (nor path relative to function matched()) to variables. 
 * add attribute @onEvents to <parameter>. 
 * convert XML tree <eval> to XPath @eval. 

 +Example with actual notation+: 
 <pre><code class="xml"> 
 <processor type="ReplaceProcessor"> 
     <parameter name="namespaces"> 
         <entry key="e">http://software.in2p3.fr/lavoisier/entries.xsd</entry> 
     </parameter> 
     <parameter name="variables"> 
         <entry key="prefix" eval="path('prefix')"/> 
     </parameter> 
     <parameter name="xml_variables"> 
         <entry key="xml" eval="request()"/> 
     </parameter> 
     <parameter name="nodes">/e:entries/e:entry[@key &lt; $xml/@value]</parameter> 
     <parameter name="node_value">'1'</parameter> 
     <parameter name="node_name">concat(path('prefix'),'-',text())</parameter> 
     <parameter name="node_name_as_xpath">true</parameter> 
 </processor> 
 </code></pre> 

 +The same example with target notation+: 
 <pre><code class="xml"> 
 <processor type="ReplaceProcessor" xmlns:e="http://software.in2p3.fr/lavoisier/entries.xsd" 
            match="/e:entries/e:entry[@key context="/e:entries/e:entry[@key &lt; request()/@value]"> 
     <parameter name="node_name" eval="concat(path('prefix'),'-',text())"/> 
     <parameter name="node_value">1</parameter> 
 </processor> 
 </code></pre> 

 +Example XPath expression+: 
 <pre> 
 choose( 
     $a != @id, 
     view('v', arguments() | entry('k', post()/*/*[@id=$a])), 
     view('v', arguments() | entry('k', post()/*/*[@id=current()/*/*[@name=property('name')]/@id])) 
 ) 
 </pre> 
 Then the following expressions must be evaluated for each selected event: 
 * <code>@id</code> 
 * <code>current()/*/*[@name=$_4]/@id</code> 

 +Main benefits+: 
 * less verbose. 
 * same XPath functions in both contexts. 
 * any parameter can be evaluated as an XPath expression.

Back