Call macro with new root

John Redford <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
I want to be able to call a macro with a given node used as the effective "root"
for the called macro.  For example, given the data model:

(root)
  |
  +- user = "Big Joe"
  |
  +- latestProduct
      |
      +- url = "products/greenmouse.html"
      |
      +- name = "green mouse"

I want to have these macros:

<#macro Product>
 ${name} (${url})
</#macro>

<#macro Describe>
 ${user}'s latest product is <@Product=latestProduct/>.
</#macro>

Such that the result is:

Big Joe's latest product is green mouse (products/greenmouse.html).

I have looked into ways to achieve something like this using
TemplateDirectiveModel to writing a directive that re-roots the environment, but
that does not seem possible.


------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.