From: <kea...@na...> - 2003-03-05 22:36:25
|
Dario, I'm not the macro expert, so someone else should probably chime in. I'm pretty sure you only need to declare your macro once per context (i.e., request). Using an #include is probably the preferred way. There has been discussion of implementing global macros, but this is still in the discussion stage. You are correct that you cannot directly use a block as an argument to a macro call. (Your #setblock work-around is right on.) You might want to consider changing your macro to a directive, which would allow you to use a block. E.g., #xsltranform stylesheet="/myFile.xsl" { <xmltag name="hello" value="$myvar"/> } This could make a pretty cool addition to WM. Directives aren't really too hard to create. See http://www.webmacro.org/PluggableDirectiveMechanism and look at the source for some simple directives. Hope this helps. Keats -----Original Message----- From: Dario Liberman [mailto:lib...@in...] Sent: Wednesday, March 05, 2003 2:26 PM To: kea...@na...; web...@li... Subject: Re: [Webmacro-devel] special characters - now slash directory separator problem Keats, Thank you very very much. By the way... I am using macros now :-) I am supposed to include the macro file in all my files??? Also, including it in the main wm, does not heredate it to its internal included files. So it seems that not only the main wms, but really all wms need the macro include statement, right? It would be nice to have it included in my configuration file or something for global access. Also, is there any way to make a macro with body? by now, instead of for example doing: #ApplyXSL ("http://myfile.xsl") { <xmltag name="hello" value="$myvar"/> } I am doing this: #setblock as macro $thebodyblk { <xmltag name="hello" value="$myvar"/> } #ApplyXSL ("/myfile.xsl", $thebodyblk) The first sintax is much nicer I beleave. There shoud be a directive that creates a macro with body, say.. #macrowb the people at freemarker, I think use the word "nested" to refer to the bodyblock during the macro definition. When I finish this ApplyXSL tool (I hope to have the time to do it), I will expose it to the list, maybe someone likes it. Cheers, Dario. |