cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Dynamic SVG Creation
Date Mon, 09 Feb 2004 17:18:13 GMT

i will try this out !!

-----Original Message-----
From: Brent L Johnson []
Sent: 09mm2004 18:07
Subject: RE: Dynamic SVG Creation 

Not sure if this is what you need.. but here goes:


<map:match pattern="images/*/*.jpg">
    <map:generate src="skins/{global:skin}/svg/{1}.svg"/>
    <map:transform src="skins/{global:skin}/{1}Image.xsl">
        <map:parameter name="title" value="{2}"/>
    <map:serialize type="svg2jpeg"/>

SVG File:

<svg width="150" height="12">
    <ttf-font type="DieNasty"/>
    <rect x="0" y="0" width="150" height="12"
    <text x="8px" y="11px"

XSL File:

<xsl:include href="fonts.xsl"/>
<xsl:param name="title"/>

<xsl:template match="text">
        <xsl:copy-of select="@*"/>

Description of how it works:

You can ignore the font stuff if you want.  I just created
an XSL file that has embedded fonts that get included when
the transform is complete.  That way I can use any TTF font
I want for my text (so it looks the same on all platforms
regardless of fonts installed on the server).

Also.. the svg/blocks.xml file basically converts the
image name to some useful title.  You can ignore this
too if you just want to use some static title.  This is
also not needed.. you can simply remove that {1}Image.xsl
transform from this example and your image will say "Home".

So where you want to display this image in HTML you would do:

<img src="/images/block/main.jpg"/>

It will then look for the file in skins/myskin/svg/block.svg.
(if myskin is global.. again you dont need this.. its just
what my sitemap looks like.. you can specify it as whatever
SVG file you want).

That's really it.. its pretty simple once you get
the hang of it!

Good luck,

- Brent

> -----Original Message-----
> From: 
> [] 
> Sent: Monday, February 09, 2004 11:49 AM
> To:
> Subject: Dynamic SVG Creation 
> Hi Kieran,
> Is it possible to put this code between xsp logic tags 
> instead of a function ??
> And when you have created the svgdoc and svgroot, how can you 
> view it??   My
> intention is to put the generated svg in a html body.
> It would help if i saw a very tiny example of all files 
> needed to fullfill the job and maybe alterations in the 
> sitemap if needed ?  could you give me the code that 
> generates a small blue rectangle with some dynamic text in it 
> and then how to view it in a html page? Kind regards, Robby
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message