Josh Chamas wrote:

As the name XMLSubs implies, the XML tags in particular are transformed
into perl subroutines during compilation. So trying to $Response->Write()
those tags will not work. $Response->Write is for direct output, but
XMLSubs need to be executed as code. If you want to execute XMLSubs
dynamically after building up the string text, then you will have to
build up the text string on the fly, and then dynamically execute
an include scalar ref like:


my $execute_tag = '<mobile\:href href="home.xml?t=l">Custom Link</mobile\:href>';
$Response->Include(\$execute_tag);


Notice the backslashes to make sure the compiler does not try to compile the tag
before the script executes.


In this case though, it is probably better if you did:

 <% if($gcompatible) { %>
    <mobile:href href="home.xml?t=l">Custom Link</mobile:href>
 <% } else { %>
     ...
 <% } %>

If what you really want is to build up XML during script processing
for later transformation, I would recommend you look into using the
XSLT methods for this, which does the XML transformation during the output stage,
after $Response->Write() is done.

You're right, XSLT will do better for me in this case.
I was actually impressed at how far the parser got and "almost" but not quite made it.
I mean, this understandably works:
$Response->write(&mobile::href({ 'icon' => 'images/wallpapers.gif', 'href' => 'home.xml?t=l' }, 'Some Custom Link'));
although it also prints an extra 1, which is the include's return value. So if I either ommit the $Response->write or modify the Include so that it returns "", it's ok.
And the whole idea is if it would be possible for the XMLSub to escape itself (I know I'm oversimplifying here) as it gets expanded from tag to sub-routine.
Once again, I'm not that familiar with the internals of Apache::ASP to know how feasible this is, it just felt kind of natural from the web developer's point of view.


Regards,
Thanos Chatziathanassiou



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to