Hi Tony,
Thanks a lot for your detailed and to the point solution to my problem. It worked beautifully.
Mircea
Thanks a lot for your detailed and to the point solution to my problem. It worked beautifully.
Mircea
| Poster | Content | |||
|---|---|---|---|---|
|
nk4um User
Posts: 26
|
Hi Tony,
Thanks a lot for your detailed and to the point solution to my problem. It worked beautifully. Mircea |
|||
|
nk4um Moderator
Posts: 485
|
Hi Mircea,
XRL2 doesn''t support the [[arg:name]] syntax that you are using. I know that xrl(1) in NetKernel 3 did support it, and now in NetKernel 4 the mapper does support it too. The documentation for XRL2 doesn''t mention it but I''ve noticed in the codebase there is a limited support for it in the compact xrl:resolve! It could be an enhancement to add this functionality but there is another way now. Arguments can be added to requests:
or compactly:
Then ensure your endpoint definition has an <id> tag on it so that the meta request in the xrl:include can find it:
Then the request issued by the xrl:include will be constructed with the correct identifier syntax however that is defined. Hope that helps, Tony |
|||
|
nk4um User
Posts: 26
|
Hi,
I''m struggling trying to do something simple in concept. Essentially, I need to programmatically construct an URI by concatenating 2 parts a fix one and another being variable. In some sort of pseudo-code: URI= "res:/expenses/fixed/month" + ${arg:month-number} => "res:/expenses/fixed/month/7" Note: By design, the URI-like string above "res:/expenses/fixed/month" does not resolve to any endpoint. But res:/expenses/fixed/month/7 does. The following is the content of a content.xml file that is to be pushed into an XRL template. "month-number" is an argument that is passed to active:xrl2 so it is available when the content.xml is resolved. <div xmlns:xrl="http://netkernel.org/xrl"> <xrl:include> <xrl:identifier>meta:id-builder</xrl:identifier> <xrl:argument name="base"> <literal>res:/expenses/fixed/month</literal> </xrl:argument> <xrl:argument name="appender">arg:month-number</xrl:argument> </xrl:include> <xrl:include identifier="res:/expenses/variable/month/[[arg:month-number]]"/> <xrl:include identifier="res:/expenses/variable/month/6"/> </div> In the div element above you can see 2 failed and one successful attempts to achieve my goal. The third xrl:include works fine but the month is hard-coded. Please advise on a workable solution. Thanks a lot, Mircea |