Subject: Re: [xsl] xslt svg problem From: tcn@xxxxxxxxxxxxx (Trevor Nash) Date: Sat, 01 Sep 2001 22:28:14 GMT |
If you look in the SVG DTD you will find that it plays a little trick on you: it has a default namespace declaration for the svg element. This means that if the DTD is used the <a> element is not in the null namespace, its in the SVG one. This means you either have to not read the DTD (as you discovered, this works) or declare the SVG namespace in the stylesheet and say match="svg:a" instead of match="a". The second is more correct. Regards, Trevor Nash >Hi, > >I'm trying to create png/imagemap from svg. My svg >Documents are first created from GraphXML-files using >Xalan. Next I convert them to png with the >batik-rasterizer. Then I try to extract the >xlink:hrefs from the svg to build an Imagemap. And >there the problem starts. Xalan doesn't recognizes the ><a> element when I use my document like this (The dtd >is in the same folder): > ><?xml version="1.0" encoding="iso-8859-1" >standalone="no"?> > <!DOCTYPE svg SYSTEM "svg-20000802.dtd"> ><svg xmlns:xlink="http://www.w3.org/1999/xlink" >xml:space="preserve" width="5.4959999999999996in" >height="5.4959999999999996in"> > <circle style="fill:blue;stroke:red;" cx="0.5496in" >cy="0.5496in" r="0.5496in"/> > <a xlink:href="http://www.cwi.nl/~ivan"> > <text style="fill:red" x="52.211999999999996" >y="114.42399999999999">Project leader</text> > </a> ></svg> > >But when I change <!DOCTYPE svg SYSTEM >"svg-20000802.dtd"> to <!DOCTYPE svg> everything works >fine. > >What am I doing wrong? > >MAX > >P.s.: that's my XSL: > ><xsl:stylesheet >xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >version="1.0" > >xmlns:xlink="http://www.w3.org/1999/xlink"> ><xsl:output encoding="UTF-16" method="html"/> ><xsl:template match="/"> > <xsl:element name="HTML"> > <xsl:element name="HEAD"> > <xsl:element >name="TITLE">imagemapbeispiel</xsl:element> > </xsl:element> > <xsl:element name="BODY"> > <xsl:element name="IMG"> > <xsl:attribute name="src">out.png</xsl:attribute> > > <xsl:attribute name = "usemap" >>#explmap</xsl:attribute> > </xsl:element> > <xsl:element name = "MAP"> > <xsl:attribute name = "name" >>explmap</xsl:attribute> > <xsl:apply-templates/> > </xsl:element> > </xsl:element> > </xsl:element> ></xsl:template> ><xsl:template match="a"> > <xsl:element name = "AREA"> > <xsl:attribute name = "href" > > <xsl:value-of select="@xlink:href" /> > </xsl:attribute> > <xsl:attribute name = "shape" >>rect</xsl:attribute> > <xsl:variable name = "reftext"><xsl:value-of >select="text"/></xsl:variable> > <xsl:variable name = "length"><xsl:value-of >select = "string-length($reftext)*5"/></xsl:variable> > <xsl:variable name = "xwert"> > <xsl:value-of select = "text/@x" /> > </xsl:variable> > <xsl:variable name = "ywert"> > <xsl:value-of select = "text/@y" /> > </xsl:variable> > <xsl:variable name = "xwert2"> > <xsl:value-of select = "$xwert+$length" /> > </xsl:variable> > <xsl:variable name = "ywert2"> > <xsl:value-of select = "$ywert+-19" /> > </xsl:variable> > <xsl:attribute name = "coords" > > <xsl:value-of select = "$xwert" /> > <xsl:text>,</xsl:text> > <xsl:value-of select = "$ywert2" /> > <xsl:text>,</xsl:text> > <xsl:value-of select = "$xwert2" /> > <xsl:text>,</xsl:text> > <xsl:value-of select = "$ywert" /> > </xsl:attribute> > </xsl:element> > </xsl:template> ></xsl:stylesheet> > > > >__________________________________________________ >Do You Yahoo!? >Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger >http://im.yahoo.com > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list -- Traditional training & distance learning, Consultancy by email Melvaig Software Engineering Limited voice: +44 (0) 1445 771 271 email: tcn@xxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xslt svg problem, Max Nitribitt | Thread | Re: [xsl] xslt svg problem, Max Nitribitt |
Re: [xsl] Re: javascript & XSL, Mike Brown | Date | Re: [xsl] xslt svg problem, Max Nitribitt |
Month |