-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is all related to Mike Chamberlain's patch here:

http://nagoya.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]&msgNo=13

I *think* it might be the <xsp:attribute> tag that's the troublemaker here. 
Need to do some tests to find out. I'll get back to you.

On Wednesday 05 June 2002 7:32 pm, Kevin Stefanik wrote:
> I fixed the compilation problem by changing the perl code generated at the
> end_element handler for xsp:element code to:
>
>         return '} $parent->appendChild($elem); '. "\n";
>
> from:
>         return '$parent = $parent->getParentNode;' . "\n";
>
> This is line ~691 in XSP.pm.  This gets the xsp page compiling.
>
> Even after this fix, though, I think there's some flaw in the nesting logic
> for generating code to create elements in 1.6.  When I call a function, it
> ends up adding the elements defined by that function to the parent node of
> the node I want to add them to.  The node to which I thought I was adding
> new elements in my function is instead added to the same parent _after_ the
> elements generated by my function call.
>
> The 1.6rc3 seems to attempt to localize $parent by doing a "my
> $parent=$elem" and leaving the brace open when startig new nodes.  However,
> when a function is called in that scope, the function call doesn't pick up
> the my'ed $parent in the scope from which it's called, but rather picks up
> the $parent from the scope in which the function was defined.  I don't know
> if that's expected behaviour for perl or not?
>
> The line that I deleted ($parent=$parent.getParentNode;) won't affect
> anything because of the scoping.  If it is inside the right brace, it only
> affects the local $parent and sets it to the newly created element ($elem),
>  but the value will be lost when we go out of the block, right?   If it's
> outside the brace, there shouldn't be a need to back up one level, because
> only the local $parent was changed in the block.
>
> I worked around it by explicitly passing a $parent parameter to my
> functions. Everything works as expected now, but I don't know if this is a
> reasonable solution.  It seems contradictory to the philosophy of blindly
> embedding tags.
>
> Thanks,
> Kevin
>
> 1.6rc3 with my fix generates:
>  my $elem; { $elem = $document->createElement(q|CurrentDirectory|); my
>  $parent = $elem;
> include_file($dir."/DirectoryInfo.xml");
> } $parent->appendChild($elem);
>
> and:
>
> sub include_file {
>  my ($filename)=@_;
>           my $elem; { $elem = $document->createElement(q|xi:include|);my
> $parent = $elem;
> $parent->setAttribute(q|xmlns:xi|, "". q|http://www.w3.org/2001/XInclude|);
> $parent->setAttribute(q|href|, "". do {$filename});
> } $parent->appendChild($elem);
>
> } # end of include_file
>
>
>
> 1.52 generates:
>  my $elem; { $elem = $document->createElement(q|CurrentDirectory|); my
>  $parent = $elem;
> include_file($dir."/DirectoryInfo.xml");
> } $parent->appendChild($elem);
>
> and:
>
> sub include_file {
>  my ($filename)=@_;
>           { my $elem =
> $document->createElement(q|xi:include|);$parent->appendChild($elem);
> $parent = $elem; }
> $parent->setAttribute(q|xmlns:xi|, "". q|http://www.w3.org/2001/XInclude|);
> $parent->setAttribute(q|href|, "". do {$filename});
> $parent = $parent->getParentNode;
>
> } # end of include_file
>
> -------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

- -- 
<:->get a SMart net</:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE8/mbJVBc71ct6OywRAg0pAKDJ/wylsTNPFfEHjyoDgMe33sCjuwCff80P
CZggFjN4i1faGcOoDXC1MYo=
=1TUx
-----END PGP SIGNATURE-----

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

Reply via email to