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/08 18:00:04 UTC

[WIKI-UPDATE] Jars2exclude Sat Mar 8 18:00:03 2003

Page: http://wiki.cocoondev.org/Wiki.jsp?page=Jars2exclude , version: 11 on Sat Mar  8 16:50:04 2003 by Scherler

- \\
- !Goal\\
?      --

+ !Goal
- !Introduction\\
?              --

+ !Introduction
- # Label lib which should be excluded with "2exclude", but leave exceptions untouched\\
+ Step 1a Label lib which should be excluded with "2exclude"\\
+ Step 1b Leave exceptions untouched\\
- # Copy all elements except those which are labeled "2exclude"\\
? ^

+ Step 2 Copy all elements except those which are labeled "2exclude"\\
? ^^^^^^

- !Step 1: Label lib which should be excluded with "2exclude" (leave exceptions untouched)
?                                                            -----------------------------

+ !Step 1a: Label lib which should be excluded with "2exclude"
?        +

- 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).\\
?                                                               -

+ 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:choose>
- <xsl:when test="starts-with(text(), 'optional/')"> [2]\\
+ 
- The jars.xml looks like this:\\
?                         ^^^^

+ The jars.xml looks like e.g.:\\
?                         ^^^^

-     <title/>
-     <description/>
-     <used-by/>
-     <lib>core/jvm1.2/excalibur-datasource-vm12-20021121.jar</lib>
-     <homepage/>
+ <title>The XML parser</title>
+ <description>Xerces is an XML parser.</description>
+ <used-by>Cocoon</used-by>
+ <lib>core/xercesImpl-2.0.0.jar</lib>
+ <homepage>http://xml.apache.org/xerces-j/</homepage>
- The example file would not meet the criteria. The following would:
+ The example file would not meet the criteria (__starts-with(text(), 'optional/')__). The following would:
?                                             +++++++++++++++++++++++++++++++++++++++

- ...
+ <title>Servlet API</title>
+ <description/>
+ <used-by>Cocoon</used-by>
- ...
+ <homepage>http://jakarta.apache.org/tomcat/</homepage>
- <file>}}}
+ </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 the following code:[2].
?                                                                                                                                                ^    ^^  ---------------------- -----

+ 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 will now be explained.
?                                                                                                                                               + ^^^^^^    ^^^^^^

+ !Step 1b Leave exceptions untouched
+ We introduced one <xsl:choose>. If we nested a little bit deeper we can define exceptions. 
+ {{{<lib>
+ <xsl:choose>
+ 	<xsl:when test="starts-with(text(), 'optional/')">
+ 		<xsl:choose>
+ 			<xsl:when test="substring-after(text(), 'optional/')='servlet_2_2.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>}}} 
+ 
-  Here is an example of an exception:
- {{{
- <xsl:when test="substring-after(text(), 'optional/')='servlet_2_2.jar'">
- <xsl:value-of select="."/>
- </xsl:when>
- }}}
+ !Step 2: Copy all elements except those which are labeled "2exclude"
- Transforming this result with exclude2jars.xsl [3] will result in the new jar.xml (without the exclusions, but with the exceptions).\\
+ Transforming this result with exclude2jars.xsl [3] will result in the new jar.xml (without the exclusions, but with the exceptions). We just have to introduce another XPath function\\
?                                                                                                                                     +++++++++++++++++++++++++++++++++++++++++++++++++

- \\
+ {{{<xsl:template match="jars">
+ <jars>
+ <xsl:copy-of select="file[lib!='2exclude']"/>
+ </jars>
+ </xsl:template>}}}\\
+