You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ed...@apache.org on 2006/01/18 11:03:32 UTC
svn commit: r370102 - in /lenya/trunk/src/modules/svg: ./ dummy.xml
sitemap.xmap xslt/ xslt/image2svg.xsl xslt/scale.xsl
Author: edith
Date: Wed Jan 18 02:03:28 2006
New Revision: 370102
URL: http://svn.apache.org/viewcvs?rev=370102&view=rev
Log:
Added svg module
Added:
lenya/trunk/src/modules/svg/
lenya/trunk/src/modules/svg/dummy.xml
lenya/trunk/src/modules/svg/sitemap.xmap
lenya/trunk/src/modules/svg/xslt/
lenya/trunk/src/modules/svg/xslt/image2svg.xsl
lenya/trunk/src/modules/svg/xslt/scale.xsl
Added: lenya/trunk/src/modules/svg/dummy.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/svg/dummy.xml?rev=370102&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/dummy.xml (added)
+++ lenya/trunk/src/modules/svg/dummy.xml Wed Jan 18 02:03:28 2006
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns:svg="http://www.w3.org/2000/svg">
+ This is a dummy file
+</svg>
\ No newline at end of file
Added: lenya/trunk/src/modules/svg/sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/svg/sitemap.xmap?rev=370102&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/sitemap.xmap (added)
+++ lenya/trunk/src/modules/svg/sitemap.xmap Wed Jan 18 02:03:28 2006
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <map:pipelines>
+
+ <map:pipeline>
+ <map:match pattern="*/*/**.*">
+
+ <map:match type="regexp" pattern="(.*\.)(jpg|JPG|Jpg|jpeg|Jpeg|JPEG)$">
+ <map:generate src="dummy.xml"/>
+ <map:transform src="xslt/scale.xsl">
+ <map:parameter name="url" value="context://lenya/pubs/{../1}/resources/{../2}/{../3}.{../4}"/>
+ <map:parameter name="width" value="{request-param:width}"/>
+ <map:parameter name="height" value="{request-param:height}"/>
+ </map:transform>
+ <map:serialize type="svg2jpeg"/>
+ </map:match>
+
+ <map:match type="regexp" pattern="(.*\.)(png|PNG|Png)$">
+ <map:generate src="dummy.xml"/>
+ <map:transform src="xslt/scale.xsl">
+ <map:parameter name="url" value="context://lenya/pubs/{../1}/resources/{../2}/{../3}.{../4}"/>
+ <map:parameter name="width" value="{request-param:width}"/>
+ <map:parameter name="height" value="{request-param:height}"/>
+ </map:transform>
+ <map:serialize type="svg2png"/>
+ </map:match>
+
+ <map:match type="regexp" pattern="(.*\.)(tif|TIF|Tif)$">
+ <map:generate src="dummy.xml"/>
+ <map:transform src="xslt/scale.xsl">
+ <map:parameter name="url" value="context://lenya/pubs/{../1}/resources/{../2}/{../3}.{../4}"/>
+ <map:parameter name="width" value="{request-param:width}"/>
+ <map:parameter name="height" value="{request-param:height}"/>
+ </map:transform>
+ <map:serialize type="svg2tiff"/>
+ </map:match>
+
+ <map:match type="regexp" pattern="(.*\.)(gif|GIF|Gif)$">
+ <map:read src="fallback://lenya/pubs/{../1}/resources/{../2}/{../3}.{../4}" mime-type="image/gif" />
+ </map:match>
+ </map:match>
+
+ </map:pipeline>
+
+ </map:pipelines>
+</map:sitemap>
Added: lenya/trunk/src/modules/svg/xslt/image2svg.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/svg/xslt/image2svg.xsl?rev=370102&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/xslt/image2svg.xsl (added)
+++ lenya/trunk/src/modules/svg/xslt/image2svg.xsl Wed Jan 18 02:03:28 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+
+ <xsl:template match="xhtml:img">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="@src">
+ <xsl:attribute name="src">
+ <xsl:value-of select="."/>
+ <xsl:text>?</xsl:text>
+ <xsl:text>lenya.module=svg&</xsl:text>
+ <xsl:if test="string(../@height)">
+ <xsl:text>height=</xsl:text><xsl:value-of select="../@height"/><xsl:text>&</xsl:text>
+ </xsl:if>
+ <xsl:if test="string(../@width)">
+ <xsl:text>width=</xsl:text><xsl:value-of select="../@width"/>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
Added: lenya/trunk/src/modules/svg/xslt/scale.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/svg/xslt/scale.xsl?rev=370102&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/xslt/scale.xsl (added)
+++ lenya/trunk/src/modules/svg/xslt/scale.xsl Wed Jan 18 02:03:28 2006
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <xsl:param name="url"/>
+ <xsl:param name="height"/>
+ <xsl:param name="width"/>
+
+ <xsl:template match="/">
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$width}" height="{$height}" version="1.1">
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="{$width}" height="{$height}" xlink:href="{$url}"/>
+ </svg>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org