cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beyaNet Consultancy <beya...@ntlworld.com>
Subject Dynamic SVG tag...
Date Mon, 22 Mar 2004 07:56:14 GMT
Hi,
I have been trying to resolve an issue with how to make an opening svg  
tag dynamic, in terms of the width and height, and wondered if you have  
an suggestions. I have an xsp page which spits out an svg as so:

<xsp:structure>
    <xsp:include>test.ArtistImages</xsp:include>
</xsp:structure>

<svg width="x" height="x" x="0" y="0">
	<xsp:logic>
		........... Code ....................
		int svgWidth = Integer.parseInt(<util:get-sitemap-parameter  
name="svgWidth"/>);
		int svgHeight = Integer.parseInt(<util:get-sitemap-parameter  
name="svgHeight"/>);
	</xsp:logic>	
	
	<!-- spit the image back to the browser requester -->
	<xsp:element name="svg">
		<xsp:attribute  
name="width"><xsp:expr>svgWidth</xsp:expr></xsp:attribute>
		<xsp:attribute  
name="height"><xsp:expr>svgHeight</xsp:expr></xsp:attribute>
		<xsp:attribute name="viewBox">0 0 <xsp:expr>svgWidth</xsp:expr>  
<xsp:expr>svgHeight</xsp:expr></xsp:attribute>
		<xsp:element name="image">
			<xsp:attribute name="x">0</xsp:attribute>
			<xsp:attribute name="y">0</xsp:attribute>
			<xsp:attribute name="border">0</xsp:attribute>
			<xsp:attribute  
name="width"><xsp:expr>imgWidth</xsp:expr></xsp:attribute>
			<xsp:attribute  
name="height"><xsp:expr>imgHeight</xsp:expr></xsp:attribute>
			<xsp:attribute  
name="xlink:href">data:image/jpeg;base64,<xsp:expr>base64</xsp:expr></ 
xsp:attribute>
		</xsp:element>
	</xsp:element>
</svg>

What I need to be able to do is to construct the opening svg tag by  
pulling in the values of svgWidth and svgHeight. So for example:

<svg width="svgWidth" height="svgHeight">

How would I go about doing this in this instance?

Peter
Mime
View raw message