home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / gump2samples.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.8 KB  |  106 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17.  
  18. <!--+
  19.     | Convert Gump descriptor with Cocoon blocks to the Blocks Samples page
  20.     |
  21.     | CVS $Id: gump2samples.xsl,v 1.4 2004/05/01 00:51:21 joerg Exp $
  22.     +-->
  23.  
  24. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  25.  
  26.   <xsl:template match="/root">
  27.     <samples name="Blocks Samples">
  28.       <group name="Back">
  29.         <sample href=".." name="Back">
  30.           Back to the samples home page.
  31.         </sample>
  32.       </group>
  33.       <xsl:variable name="xsamples" select="xsamples/sample"/>
  34.       <xsl:variable name="blocks" select="gump/module/project[starts-with(@name, 'cocoon-block-')]"/>
  35.       <xsl:variable name="includedBlocks" select="$blocks[@name = $xsamples/@name]"/>
  36.       <xsl:variable name="excludedBlocks" select="$blocks[not(@name = $xsamples/@name)]"/>
  37.       <xsl:variable name="includedStableBlocks" select="$includedBlocks[@status = 'stable']"/>
  38.       <xsl:variable name="includedUnstableBlocks" select="$includedBlocks[@status = 'unstable']"/>
  39.       <xsl:variable name="includedDeprecatedBlocks" select="$includedBlocks[@status = 'deprecated']"/>
  40.  
  41.       <xsl:if test="$includedStableBlocks">
  42.         <group name="Stable Blocks">
  43.           <xsl:apply-templates select="$includedStableBlocks">
  44.             <xsl:sort select="@name"/>
  45.           </xsl:apply-templates>
  46.         </group>
  47.       </xsl:if>
  48.  
  49.       <xsl:if test="$includedUnstableBlocks">
  50.         <group name="Unstable Blocks">
  51.           <note>
  52.             Blocks below are subject to change without notice!
  53.           </note>
  54.           <xsl:apply-templates select="$includedUnstableBlocks">
  55.             <xsl:sort select="@name"/>
  56.           </xsl:apply-templates>
  57.         </group>
  58.       </xsl:if>
  59.  
  60.       <xsl:if test="$includedDeprecatedBlocks">
  61.         <group name="Deprecated Blocks">
  62.           <note>
  63.             Blocks below will be removed in the future!
  64.           </note>
  65.           <xsl:apply-templates select="$includedDeprecatedBlocks">
  66.             <xsl:sort select="@name"/>
  67.           </xsl:apply-templates>
  68.         </group>
  69.       </xsl:if>
  70.  
  71.       <xsl:if test="$excludedBlocks">
  72.         <group name="Excluded Blocks">
  73.           <note>
  74.             Blocks below are either excluded from the build or have no samples.
  75.           </note>
  76.           <xsl:apply-templates select="$excludedBlocks" mode="excluded">
  77.             <xsl:sort select="@name"/>
  78.           </xsl:apply-templates>
  79.         </group>
  80.       </xsl:if>
  81.     </samples>
  82.   </xsl:template>
  83.  
  84.   <xsl:template match="project">
  85.     <xsl:variable name="name" select="substring-after(@name,'cocoon-block-')"/>
  86.     <xsl:variable name="sample" select="document(concat($name, '/', $name,'.xsamples'))/xsamples/group/sample"/>
  87.     <xsl:if test="$sample">
  88.       <xsl:apply-templates select="$sample"/>
  89.     </xsl:if>
  90.   </xsl:template>
  91.  
  92.   <xsl:template match="project" mode="excluded">
  93.     <xsl:variable name="name" select="substring-after(@name,'cocoon-block-')"/>
  94.     <sample name="{$name}">
  95.       <strong>Note:</strong> Block has no samples or was excluded from the build.
  96.     </sample>
  97.   </xsl:template>
  98.  
  99.   <xsl:template match="@*|node()">
  100.     <xsl:copy>
  101.       <xsl:apply-templates select="@*|node()"/>
  102.     </xsl:copy>
  103.   </xsl:template>
  104.  
  105. </xsl:stylesheet>
  106.