Feature #5558
Updated by Reynaud Sylvain almost 11 years ago
<pre><code class="xml"> <view name="v"> <argument name="site">NONE</argument> <connector type="XMLConnector"> <parameter name="content"> <entry key="CC-IN2P3">Lyon</entry> <entry key="LAPP">Annecy</entry> <entry key="CERN">Geneve</entry> </parameter> </connector> <processors> <!-- the less flexible solution (the XPath is fixed in the view) --> <processor type="SelectProcessor" match="/*/*[@key=$site]" disabled="$site='NONE'"/> </processors> </view> <!-- the less efficient solution (requires a data structure to be built) --> <parameter eval="view('v')/*/*[@key=$site]"/> <!-- argument 'site' is evaluated by view 'v' --> <parameter eval="view('v/*/*[@key=$site]', arguments())"/><!-- view 'v' must have <argument name="site"/> --> <parameter eval="view('v/*/*[@key=arguments()[@key="site"]])]', arguments())"/> <!-- argument 'site' is evaluated by current view --> <parameter eval="view(concat('v/*/*[@key=',quot($site),']'))"/> <parameter eval="view(build_xpath('v/*/*[@key={$site}'))"/> eval="view(eval_arguments('v/*/*[@key=$site'))"/> </code></pre> +Note+: build_xpath() must disable optimizer for {match()/@id}