You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/03/30 14:00:05 UTC
[WIKI-UPDATE] jars2exclude GETlenya Scherler Sun Mar 30 14:00:05 2003
Page: http://wiki.cocoondev.org/Wiki.jsp?page=jars2exclude , version: 10 on Sun Mar 30 11:46:25 2003 by Scherler
- ''This page is a place-holder. I wrote 2 XSLT- files that are working fine to exclude jars from lib/*, but I would like to have more "intelligence" (please see below). So consider this a work in progress -- [Scherler]''
- ----
- I wrote 2 XSLT- files that are working fine to do the job, but I would like to have more "intelligence" (please see below):\\
- The first xslt (jars2exclude.xsl [2]) checks the <lib> element form the jars.xml whether it starts with 'optional/' (the dir to exclude files from). If so they will be labeled "2exclude" (there are exceptions - you will see later).\\
- <xsl:when test="starts-with(text(), 'optional/')"> [compare 2]\\
- The jars.xml looks like this:\\
- {{{...
- <file>
- <title/>
- <description/>
- <used-by/>
- <lib>core/jvm1.2/excalibur-datasource-vm12-20021121.jar</lib>
- <homepage/>
- </file>
- ...}}}
- The example file would not meet the criteria. The following would:
- {{{<file>
- ...
- <lib>optional/servlet_2_2.jar</lib>
- ...
- <file>}}}
- But this certain file has to be left untouched [1] - this is one of n exceptions (2 are mentioned in [1], but I need more<-n exception). This is be done with <xsl:choose><xsl:when>[2]. Here is an example of an exception:
- {{{
- <xsl:when test="substring-after(text(), 'optional/')='servlet_2_2.jar'">
- <xsl:value-of select="."/>
- </xsl:when>
- }}}
- The result of the transformation [2] will look like this:
- {{{
- <file>
- <title>XML Catalog Entity Resolver</title>
- ...
- <lib>2exclude</lib>
- ...
- </file>
- <file>
- <title>Servlet API</title>
- ...
- <lib>optional/servlet_2_2.jar</lib>
- ...
- </file>
- }}}
- Transforming this result with exclude2jars.xsl [3] will result in the new jar.xml (without the exclusions, but with the exceptions).\\
- \\
- Ok, that is nice but I would prefer not to hard code the exceptions, e.g.:\\
- substring-after(text(), '__optional/__')='__servlet_2_2.jar__'\\
- hard coded exception e.g. __optional/__\\
- \\
- I prefer to use something like jars2exclude.xml [4] where I declare the hard coded exceptions. \\
- {{{...
- <dir2exclude>optional/</dir2exclude>
- <except>servlet_2_2.jar</except>
- ...
- }}}\\
- ..but how can I do that?\\
- Have a look at sitemap.snippet [5] to install it on your local cocoon version.
- Any help and any ideas welcome.
-
- [1|http://wiki.cocoondev.org/Wiki.jsp?page=CreateMinimalWebapp]\\
- [2] jars2exclude.xsl:
- {{{
- <xsl:stylesheet version="1.0" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="jars">
- <jars>
- <xsl:apply-templates select="file"/>
- </jars>
- </xsl:template>
- <xsl:template match="file">
- <file>
- <xsl:apply-templates/>
- </file>
- </xsl:template>
- <!--================Parsing of value===============================-->
- <xsl:template match="title">
- <title>
- <xsl:value-of select="."/>
- </title>
- </xsl:template>
- <xsl:template match="description">
- <description>
- <xsl:value-of select="."/>
- </description>
- </xsl:template>
- <xsl:template match="used-by">
- <used-by>
- <xsl:value-of select="."/>
- </used-by>
- </xsl:template>
- <!--==Excluding dir without the exceptions==-->
- <xsl:template match="lib">
- <lib>
- <xsl:choose>
- <xsl:when test="starts-with(text(), 'optional/')">
- <xsl:choose>
- <xsl:when test="substring-after(text(), 'optional/')='fop-0.20.4.jar'">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:when test="substring-after(text(), 'optional/')='servlet_2_2.jar'">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:when test="substring-after(text(), 'optional/')='commons-jxpath-1.0.jar'">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:otherwise>2exclude</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </lib>
- </xsl:template>
- <xsl:template match="homepage">
- <homepage>
- <xsl:value-of select="."/>
- </homepage>
- </xsl:template>
- </xsl:stylesheet>
- }}}
-
- [3]exclude2jars.xsl:
- {{{
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="1.0" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="jars">
- <xsl:comment>
- Add an entry for each jar file used by Cocoon, following the other entries
-
- Author: Ovidiu Predescu "ovidiu@cup.hp.com"
- Date: May 23, 2002
-
- jars2exclude have been used.
- Author: Thorsten Scherler "thorsten.scherler@wyona.org"
- Date: March 06, 2003
- This is the modified jars.xml.
- </xsl:comment>
- <jars>
- <xsl:copy-of select="file[lib!='2exclude']"/>
- </jars>
- </xsl:template>
- </xsl:stylesheet>
- }}}
- [4] jars2exclude.xml
- {{{<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Add an entry for each jar file which should be excluded by Cocoon!
-
- Author: Thorsten Scherler "thorsten.scherler@wyona.org"
- Date: March 05, 2003
-
- -->
- <jars2exclude>
- <exclude>
- <dir2exclude>optional/</dir2exclude>
- <except>fop-0.20.4.jar</except>
- <except>commons-jxpath-1.0.jar</except>
- <except>servlet_2_2.jar</except>
- </exclude>
- </jars2exclude>
- }}}
- [5]sitemap.snippet:
- {{{
- <map:pipeline>
- <!-- Step 1: Label lib which should be excluded with "2exclude", leave exceptions untouched. -->
- <map:match pattern="2Xclude.xml">
- <map:generate src="xml/jars.xml"/>
- <map:transform src="xsl/jars2exclude.xsl"/>
- <map:serialize type="xml"/>
- </map:match>
- <!-- Step 2: Copy all elements except those which are labeled "2exclude"-->
- <map:match pattern="exclude">
- <map:generate src="cocoon:/2Xclude.xml"/>
- <map:transform src="xsl/exclude2jars.xsl"/>
- <map:serialize type="xml"/>
- </map:match>
- </map:pipeline>
- }}}
-
Page: http://wiki.cocoondev.org/Wiki.jsp?page=GETlenya , version: 13 on Sun Mar 30 11:59:22 2003 by Scherler
- * Project name: lenya
+ * Project name: lenya-eclipse
? ++++++++
Page: http://wiki.cocoondev.org/Wiki.jsp?page=Scherler , version: 14 on Sun Mar 30 11:45:34 2003 by Scherler
- ** [Different between SQL & ESQL|SQLdifferenceESQL]
? ^
+ ** [Difference between SQL & ESQL|SQLdifferenceESQL]
? ^^