FYI, I've just finished a first experiment using Cameron's foreignObject
branch. I've written a plug-in that can render fo:block-containers
inside svg:foreignObject (using Apache FOP). In the end, it's even
XSL-FO in SVG in XSL-FO. ;-) I need this for a project I'm working on.
As soon as things quiet down I'll try to make it available. There's also
some OSGi-related work I have to clean up first.

Here's a minimal example of what I tried:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";
    xmlns:xlink="http://www.w3.org/1999/xlink";>
  <fo:layout-master-set>
    <fo:simple-page-master master-name="A4" page-height="29.7cm" 
page-width="21cm" margin="2cm">
      <fo:region-body/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="A4">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Hello World!</fo:block>
      <fo:block>
        <fo:instream-foreign-object background-color="#DDDDDD">
          <svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 100 100" 
width="10cm" height="10cm" overflow="visible">
            <g>
              <rect x="5" y="5" width="10" height="5" fill="red" stroke="none"/>
              <rect x="7" y="7" width="10" height="5" fill="orange" 
stroke="none"/>
            </g>
            <g transform="rotate(30, 50, 50)">
              <switch>
                <foreignObject x="10" y="10" width="80" height="80">
                  <fo:block-container width="80" height="80" 
xmlns:fo="http://www.w3.org/1999/XSL/Format";
                    display-align="center" background-color="yellow">
                    <fo:block text-align="center">Hello <fo:wrapper 
font-weight="bold">World</fo:wrapper>!</fo:block>
                  </fo:block-container>
                </foreignObject> 
              </switch>
            </g>
          </svg>
        </fo:instream-foreign-object>
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

I think it would be worthwhile to do at least a partial merge of the
foreignObject branch into trunk as Cameron's stuff seems quite fine to
me. The obvious problem is the XHTML implementation which depends in the
Flying Saucer XHTML renderer. I'd suggest to move that into the contrib
directory with a separate build. Since Flying Saucer is LGPL, we can't
redistribute the JAR but if people download the JAR themselves we can
host the source code for the plug-in as optional component for Batik.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to