More confusion from my attempts to learn sXBL through Batik -

I expect the following document to render two squares, a yellow one at
(100, 0) and a blue one at (0, 100). The color assignment through the
bound elements' "color" attribute works, but I am foiled with any
attempt to change the location of the yellow rectangle through its
bound element's x and y attributes, and it instead appears at (0, 0).
(FWIW, this still happens if I try to build a transform attribute
instead.)

What am I missing?

<svg
   xmlns="http://www.w3.org/2000/svg"; version="1.2"
   xmlns:xbl="http://www.w3.org/2004/xbl";
   xmlns:volity="http://volity.org";
   xmlns:ev="http://www.w3.org/2001/xml-events";
   >

 <defs>
   <xbl:xbl>

     <xbl:definition element="volity:colored-rect">
        <xbl:handlerGroup>
          <handler ev:event="xbl:bound" type="text/ecmascript"><![CDATA[
          var bound_rect = evt.target;
          var template = bound_rect.xblShadowTree;
         var shadow_rect = template.getElementById('the-rect');

          // Set the fill, based on the bound element's 'color' attr.
          // This works!
          shadow_rect.setAttribute('fill', bound_rect.getAttribute('color'));

          // Set the location, based on the bound element's x and y attrs.
          // This doesn't work! And I don't know why...
          shadow_rect.setAttribute('x', bound_rect.getAttribute('x'));
          shadow_rect.setAttribute('y', bound_rect.getAttribute('y'));
          ]]>
          </handler>
        </xbl:handlerGroup>
        <xbl:template>
          <rect id="the-rect"
              width="100"
              height="100"
              stroke="black"
              stroke-width="2px"
              />
        </xbl:template>
     </xbl:definition>
   </xbl:xbl>
 </defs>

 <g>
   <volity:colored-rect x="100" y="0" color="yellow" />
 </g>

 <g transform="translate(0, 100)">
   <volity:colored-rect color="blue" />
 </g>

</svg>

--
Jason McIntosh
President and Founder
Volity Games
[EMAIL PROTECTED]
617-792-3829

Digital Games for Analog People.
http://volity.net

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

Reply via email to