On Mon, Feb 20, 2006 at 10:14:06AM -0500, Tracey Zellmann wrote:
> From: Tracey Zellmann <[EMAIL PROTECTED]>
> To: fop-users@xmlgraphics.apache.org
> Date: Mon, 20 Feb 2006 10:14:06 -0500
> Subject: Re: putting an svg element into an fo document
> 
> Ok. I think I should make a smaller example, since the current document is 
> quite large. I will work on that during the day, and send it along. 
> Separately, if anyone could give me a pointer to best know practices, or a 
> working example that is similar to my case, that might also help. Basically, 
> taking an svg element from a data document, and using xslt to select that and 
> place it in an fo document.

Really what you are doing is exactly right. If I have a document that
looks like this:

<doc>
 <section type="svg">
        <svg id="body" width="21cm" height="13.5cm"
            viewBox="0 0 210 135" xmlns="http://www.w3.org/2000/svg";>
        <title>Example 1</title>
        <desc>
            Rectangle with red border and light blue interior.
        </desc>
         <rect x="10" y="20" width="150" height="70"
                fill="#eeeeff" stroke="red" stroke-width="1" />
        </svg>
   </section>
</doc>

Your XSLT file should look like:

<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:fo="http://www.w3.org/1999/XSL/Format";
    xmlns:svg="http://www.w3.org/2000/svg";
    version="1.1"
>
<xsl:template match="/">
    <!--create your pages, etc-->
</xsl:template>

<xsl:template match="[EMAIL PROTECTED]'svg']">
  <fo:instream-foreign-object>
        <xsl:copy-of select="svg:svg"/>
  </fo:instream-foreign-object>

</xsl:template>

</xsl:stylesheet>

If you are going to be doing any amount of processing with XML, it
will really help you to join the Mulberry mailing list and to get a
good book on XSLT. I have *XSLT Quickly* by Bob DuCharme, which
helped me use XSLT right away, and it still serves as my main
reference. There are of course a lot of other good books.

Paul

-- 

************************
*Paul Tremblay         *
[EMAIL PROTECTED]    *
************************

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

Reply via email to