cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-2.1/src/targets validate-build.xml
Date Mon, 22 Sep 2003 17:11:55 GMT
joerg       2003/09/22 10:11:55

  Modified:    tools/src check-jars.xsl
               src/targets validate-build.xml
  Log:
  fixing the problem with an absolute ${build} path: http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106310701410546&w=2
  Does somebody know a case where it could fail besides the one unhandled case?
  
  Revision  Changes    Path
  1.3       +51 -11    cocoon-2.1/tools/src/check-jars.xsl
  
  Index: check-jars.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/src/check-jars.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- check-jars.xsl	26 Mar 2003 13:49:25 -0000	1.2
  +++ check-jars.xsl	22 Sep 2003 17:11:55 -0000	1.3
  @@ -13,17 +13,47 @@
       |
       +-->
   
  -<xsl:stylesheet
  -  version="1.0"
  -  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   
     <xsl:output indent="yes" method="xml" doctype-public="-//APACHE//DTD Documentation
V1.0//EN" doctype-system="../dtd/document-v10.dtd" />
   
     <xsl:strip-space elements="*" />
   
  -  <xsl:param name="current-files"/>
  +  <xsl:param name="stylesheet-path" select="''"/>
  +  <xsl:param name="current-jars-path" select="''"/>
  +  <xsl:param name="current-jars-file" select="''"/>
  +
  +  <xsl:variable name="current-jars">
  +    <xsl:choose>
  +      <xsl:when test="starts-with($current-jars-path, '/')">
  +        <!-- absolute current-jars-path => simply use it -->
  +        <xsl:value-of select="concat($current-jars-path, '/', $current-jars-file)"/>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <!-- relative current-jars-path -->
  +        <xsl:choose>
  +          <xsl:when test="starts-with($stylesheet-path, '/')">
  +            <!-- absolute stylesheet path outside of COCOON_HOME, no way until now to
find the path back -->
  +            <xsl:message terminate="yes">
  +              <xsl:text>Absolute stylesheet path makes it impossible to find the
current-jars.xml. </xsl:text>
  +              <xsl:text>If you need this feature, you have to pass the COCOON_HOME
directory as </xsl:text>
  +              <xsl:text>param to the stylesheet.</xsl:text>
  +            </xsl:message>
  +          </xsl:when>
  +          <xsl:otherwise>
  +            <!-- relative stylesheet-path => build the path to current-jars-path
-->
  +            <xsl:call-template name="relativize-path">
  +              <xsl:with-param name="current-directory" select="$stylesheet-path"/>
  +            </xsl:call-template>
  +            <xsl:value-of select="concat($current-jars-path, '/', $current-jars-file)"/>
  +          </xsl:otherwise>
  +        </xsl:choose>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:variable>
  +
  +  <xsl:variable name="current-jars.xml" select="document($current-jars)"/>
   
  -  <xsl:variable name="directory" select="document($current-files)"/>
     <xsl:variable name="jars.xml" select="/"/>
   
     <xsl:template match="/">
  @@ -50,17 +80,17 @@
       </xsl:for-each>
   
       <!-- Verify if files declared in jars.xml appear in the lib/ directory -->
  -    <xsl:apply-templates select="jars//lib" mode="declared-but-doesnt-appear"/>
  +    <xsl:apply-templates select="jars/file/lib" mode="declared-but-doesnt-appear"/>
   
       <!-- Verify that files that appear in lib/ are declared in jars.xml -->
  -    <xsl:apply-templates select="$directory/jars" mode="appears-but-not-declared"/>
  +    <xsl:apply-templates select="$current-jars.xml/jars" mode="appears-but-not-declared"/>
       
   	<!-- create the documentation -->
   	<document>
   	 <header>
   	  <title>Cocoon JARs</title>
   	  <authors>
  -	   <person name="John Morrison" email="morrijr@apache.org"/>
  +	   <person name="Cocoon Developers" email="dev@cocoon.apache.org"/>
   	  </authors>
   	 </header>
   	 <body>
  @@ -74,7 +104,7 @@
   	     <th>Description</th>
   	     <th>Used by</th>
   	   </tr>
  -	   <xsl:apply-templates select="//file" mode="documentation"/>
  +	   <xsl:apply-templates select="jars/file" mode="documentation"/>
   	  </table>
        </s1>
       </body>
  @@ -86,7 +116,7 @@
     -->
     <xsl:template match="lib" mode="declared-but-doesnt-appear">
       <xsl:variable name="this" select="normalize-space(text())"/>
  -    <xsl:if test="count($directory/jars/jar[normalize-space(text()) = $this]) = 0">
  +    <xsl:if test="count($current-jars.xml/jars/jar[normalize-space(text()) = $this])
= 0">
         <xsl:message terminate="yes">
     File <xsl:value-of select="$this"/> is declared in lib/jars.xml, but doesn't appear
in the lib/ directory.
   
  @@ -164,6 +194,16 @@
   		<td><xsl:value-of select="description"/></td>
   		<td><xsl:value-of select="used-by"/></td>
   	</tr>
  +  </xsl:template>
  +
  +  <xsl:template name="relativize-path">
  +    <xsl:param name="current-directory" select="''"/>
  +    <xsl:if test="string($current-directory)">
  +      <xsl:text>../</xsl:text>
  +      <xsl:call-template name="relativize-path">
  +        <xsl:with-param name="current-directory" select="substring-after($current-directory,
'/')"/>
  +      </xsl:call-template>
  +    </xsl:if>
     </xsl:template>
   
     <xsl:template match="file" mode="no-tag" priority="-1"/>
  
  
  
  1.14      +3 -1      cocoon-2.1/src/targets/validate-build.xml
  
  Index: validate-build.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/targets/validate-build.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- validate-build.xml	29 Jun 2003 09:15:37 -0000	1.13
  +++ validate-build.xml	22 Sep 2003 17:11:55 -0000	1.14
  @@ -49,7 +49,9 @@
       <xslt in="${lib}/jars.xml" out="${build.temp}/jars.xml"
             processor="trax"
             style="${tools}/src/check-jars.xsl">
  -      <param name="current-files" expression="../../${build.temp}/current-jars.xml"/>
  +      <param name="stylesheet-path" expression="${tools}/src"/>
  +      <param name="current-jars-path" expression="${build.temp}"/>
  +      <param name="current-jars-file" expression="current-jars.xml"/>
       </xslt>
     </target>
   
  
  
  

Mime
View raw message