Vincent,
Here's the xslt I used.  In my case, I was transforming circles on an image,
into circular hotspots in an image map.  You'll need to take a look at your
svg to see what tags you want to transform.  Feel free to hack the xslt to
suit your needs.

- Mark

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd";
   xmlns:svg="http://www.w3.org/2000/svg";
   >

   <xsl:template match="/">
       <map name="imagemap">
       <xsl:apply-templates />
       </map>
   </xsl:template>



   <xsl:template match="//svg:path" >
       <xsl:copy-of select="node()"/>
       <xsl:variable name="cx" select="@cx"/>
       <xsl:variable name="cy" select="@cy"/>
       <xsl:variable name="rx" select="@rx"/>
       <area shape="circle">
           <xsl:attribute name="coords">
               <xsl:value-of select="@cx"/><xsl:text>,</xsl:text>
               <xsl:value-of select="@cy"/><xsl:text>,</xsl:text>
               <xsl:value-of select="@rx"/>
           </xsl:attribute>
       </area>
       </xsl:if>
   </xsl:template>


</xsl:stylesheet>

On 6/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi Mark, Vincent,

"Mark Fortner" <[EMAIL PROTECTED]> wrote on 06/26/2007 03:33:25 PM:

> If you're transforming it into an image map, then the tooltip is
> actually generated by the browser, there's no bounding box to
> define.  The tooltip text is shown in the "area" tag's "alt" attribute

   You need to provide the 'area' element which needs coords.  Those
coords can't be in the 'local' coordinate system of the original element,
they have to be in the img tag's coordinate system as I understand it.

   This would be very difficult to figure out properly in XSLT (it would
essentially involve implementing a large chunk of SVG in XSLT).

> <img src ="planets.gif"
> width ="145" height ="126"
> alt="Planets"
> usemap ="#planetmap" />
>
> <map id ="planetmap"
> name="planetmap">
> <area shape ="rect" coords ="0,0,82,126"
>   href ="sun.htm" target ="_blank"
>   alt="Sun" />
> </map>

   Getting back to Vincent's question.  I would suggest booting the
SVG DOM on your document.  They you can get the BBox for elements
and use getScreenCTM to map the BBox of the element to the screen
coords.

   If you want more complex shapes for the areas you can use
CompositeGraphicsNode.getOutline to get a Shape that outlines
the group (you can get the associated GraphicsNode for a DOM Node
from the BridgeContext).


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


Reply via email to