This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xslt svg problem
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] xslt svg problem
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Mon, 3 Sep 2001 16:13:35 +0100
- References: <20010901063211.88435.qmail@web10504.mail.yahoo.com> <3b915df4.2520413462@tigger>
- Reply-To: xsl-list at lists dot mulberrytech dot com
>P.s.: that's my XSL:
the cause of your problem (the namespace) has already been mentioned,
but _why_ do people use xsl:element and xsl:attribute so much?
><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>
That is
<xsl:template match="/">
<HEAD>
<TITLE>imagemapbeispiel</TITLE>
<BODY>
<IMG src="out.png" usemap="#explmap"/>
<MAP name="explmap">
<xsl:apply-templates/>
</MAP
</BODY>
</HEAD>
</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>
and that is
<xsl:template match="a">
<AREA
href="{@xlink:href}"
shape="rect"
coords="{text/@x},{text/@y - 19},{text/@x + string-length(text)*5},{text/@y}"/>
</xsl:template>
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list