You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beyaNet Consultancy <be...@ntlworld.com> on 2004/02/19 10:18:42 UTC

Logic sheet capture

Hi,
I have a map definition which captures svg images on image requests:

			<map:match pattern="**artistImage/*/*.jpg">
			 <map:generate type="serverpages" src="xsp/svg{2}.xsp">
				<map:parameter name="artistID" value="{3}"/>
			 </map:generate>
				<map:serialize type="svg2jpeg"/>			
			</map:match>

On each artist page there will be a number of images displayed which  
are specific to the artist. So in instead of creating specific xsp  
pages for each image request, svg1.xsp xsvg2.xsp etc, could i define  
one single xsp logic sheet which will allow me to determine which image  
to be processed based on a parameter passed to the logic sheet? If so,  
how do I do it? For example my svg page is currently constructed as so:

	<svg:svg width="300" height="300" y="0" x="0" viewBox="0 35 200 200">
		<xsp:element name="image">
			<xsp:attribute name="x">0</xsp:attribute>
			<xsp:attribute name="y">0</xsp:attribute>
			<xsp:attribute name="width">300</xsp:attribute>
			<xsp:attribute name="height">300</xsp:attribute>
			<xsp:attribute  
name="xlink:href">data:image/jpeg;base64,<xsp:expr>Photo2</xsp:expr></ 
xsp:attribute>
			<xsp:attribute name="id">artist1</xsp:attribute>
		</xsp:element>
	</svg:svg>

but what I want to do is, if image1.jpg is requested process image1 and  
return results:

<capture:fragment-variable name="image1">
	<svg:svg width="300" height="300" y="0" x="0" viewBox="0 35 200 200">
		<xsp:element name="image">
			<xsp:attribute name="x">0</xsp:attribute>
			<xsp:attribute name="y">0</xsp:attribute>
			<xsp:attribute name="width">300</xsp:attribute>
			<xsp:attribute name="height">300</xsp:attribute>
			<xsp:attribute  
name="xlink:href">data:image/jpeg;base64,<xsp:expr>Photo2</xsp:expr></ 
xsp:attribute>
			<xsp:attribute name="id">artist1</xsp:attribute>
		</xsp:element>
	</svg:svg>
</capture:fragment-request-attr>

<capture:fragment-request-attr name="image2">
	<svg:svg width="300" height="300" y="0" x="0" viewBox="0 35 200 200">
		<xsp:element name="image">
			<xsp:attribute name="x">0</xsp:attribute>
			<xsp:attribute name="y">0</xsp:attribute>
			<xsp:attribute name="width">300</xsp:attribute>
			<xsp:attribute name="height">300</xsp:attribute>
			<xsp:attribute  
name="xlink:href">data:image/jpeg;base64,<xsp:expr>Photo2</xsp:expr></ 
xsp:attribute>
			<xsp:attribute name="id">artist1</xsp:attribute>
		</xsp:element>
	</svg:svg>
</capture:fragment-request-attr>