Thanos Chatziathanassiou wrote:
...
---snip---
if ($test) {
$Response->write(qq{<mobile:href href="home.xml?t=l" icon="images/wallpapers.gif">Some Custom Link</mobile:href>
<mobile:separator/>});
}
---snip---
the latter dies and complains about ``Missing right curly or square bracket at...''
The strange part is that at that particular spot, my code has been peculiarly transformed:
---debug output---
if ($gcompatible) {
$Response->write(qq{<% &mobile::href({ 'icon' => 'images/wallpapers.gif', 'href' => 'home.xml?t=l' }, 'Some Custom Link'); ; &Apache::ASP::WriteRef($main::Response, \('<mobile:separator/>});
}

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.

Regards,

Josh

________________________________________________________________________
Josh Chamas, Founder    | NodeWorks - http://www.nodeworks.com
Chamas Enterprises Inc. | NodeWorks Directory - http://dir.nodeworks.com
http://www.chamas.com   | Apache::ASP - http://www.apache-asp.org



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



Reply via email to