Hi Mircea,
Variant 2 is the way to go. xrl:eval is the correct operation because it sets a string value into the xml document, xrl:include inserts an xml fragment into the document.
However there are two mistakes in your variant2:
1) xrl:eval attempts to source the specified request. Your argument month-number cannot be sourced because it is not an identifier to a resource, instead it is just a string. To fix this you can change your mapper to convert the argument it a pass-by-value string like this:
<request>
<identifier>active:xrl2</identifier>
<argument name="template">xrl:template</argument>
<argument name="content">xrl:content</argument>
<argument name="month-number" method="as-string">arg:month-number</argument>
</request>
For more details of the method attribute on declarative requests see:
http://docs.netkernel.org/book/view/book:guide:logicalreference/doc:logicalreference:module:standard:logical:declarative:request:syntax
2) When xrl process a document all xrl namespace tags are removed from the document as they are processed. What this means is that the xpath of "." will no longer be there and so cannot be substituted.
Try this:
<html xmlns:xrl="http://netkernel.org/xrl">
<body>
<h1>Monthly expenses</h1>
<xrl:eval>
<xrl:xpath>../h1</xrl:xpath>
<xrl:identifier>arg:month-number</xrl:identifier>
</xrl:eval>
<xrl:include identifier="arg:content"/>
</body>
</html>
Cheers, Tony
Variant 2 is the way to go. xrl:eval is the correct operation because it sets a string value into the xml document, xrl:include inserts an xml fragment into the document.
However there are two mistakes in your variant2:
1) xrl:eval attempts to source the specified request. Your argument month-number cannot be sourced because it is not an identifier to a resource, instead it is just a string. To fix this you can change your mapper to convert the argument it a pass-by-value string like this:
<request>
<identifier>active:xrl2</identifier>
<argument name="template">xrl:template</argument>
<argument name="content">xrl:content</argument>
<argument name="month-number" method="as-string">arg:month-number</argument>
</request>
For more details of the method attribute on declarative requests see:
http://docs.netkernel.org/book/view/book:guide:logicalreference/doc:logicalreference:module:standard:logical:declarative:request:syntax
2) When xrl process a document all xrl namespace tags are removed from the document as they are processed. What this means is that the xpath of "." will no longer be there and so cannot be substituted.
Try this:
<html xmlns:xrl="http://netkernel.org/xrl">
<body>
<h1>Monthly expenses</h1>
<xrl:eval>
<xrl:xpath>../h1</xrl:xpath>
<xrl:identifier>arg:month-number</xrl:identifier>
</xrl:eval>
<xrl:include identifier="arg:content"/>
</body>
</html>
Cheers, Tony