forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nicola...@apache.org
Subject cvs commit: xml-forrest/src/resources/convert/anakiaNmaven anakiaNmaven2document11.xsl build.xml projectNnavigation2book.xsl tabs.xml
Date Mon, 20 Oct 2003 10:00:25 GMT
nicolaken    2003/10/20 03:00:25

  Added:       scratchpad/convert/anakiaNmaven anakiaNmaven2document11.xsl
                        build.xml projectNnavigation2book.xsl tabs.xml
  Removed:     src/resources/convert/anakiaNmaven
                        anakiaNmaven2document11.xsl build.xml
                        projectNnavigation2book.xsl tabs.xml
  Log:
  Move scratchpad stuff, ie stuff that was put there to spark thoughts and
  that is not part of the real final Forrest sources, to the scratchpad.
  
  Revision  Changes    Path
  1.1                  xml-forrest/scratchpad/convert/anakiaNmaven/anakiaNmaven2document11.xsl
  
  Index: anakiaNmaven2document11.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
      <xsl:output method = "xml"  
                  version="1.0"
                  omit-xml-declaration="no" 
                  indent="no"
                  encoding="ISO-8859-1"
                  doctype-system="document-v11.dtd"
                  doctype-public="-//APACHE//DTD Documentation V1.1//EN" />
  
      <xsl:template match="/">
       <xsl:choose>
     	   <xsl:when test="name(child::node())='document'">
           <xsl:apply-templates/>
  	   </xsl:when>
    
  	   <xsl:otherwise>
  	     <document>
  	      <header><title>Error in conversion</title></header>
  	      <body>
  	       <warning>This file is not in anakia format, please convert manually.</warning>
  	      </body>
  	     </document>
  	   </xsl:otherwise>
       </xsl:choose>
      </xsl:template>
             
      <xsl:template match="document">
          <document>
              <xsl:apply-templates/>
          </document>
      </xsl:template>
      
      <!-- properties to header -->
      <xsl:template match="properties">
          <header>
              <xsl:apply-templates/>
              <authors>
                <xsl:for-each select = "author">
                  <person email="{@email}" name="{.}"/>
                </xsl:for-each>
              </authors>
          </header>
      </xsl:template>
  
      <xsl:template match="P|p">
          <p>
            <xsl:apply-templates/>
          </p>
      </xsl:template>
      
      <xsl:template match="figure">
          <figure alt="{title}" src= "{graphic/@fileref}" />
      </xsl:template>
  
      <xsl:template match="img">
         <xsl:choose>
      	<xsl:when test="name(..)='section'">
            <figure alt="{@alt}" src= "{@src}"/>
      	</xsl:when>
      	<xsl:otherwise>
            <img alt="{@alt}" src= "{@src}"/>
      	</xsl:otherwise>
         </xsl:choose>
         
         
      </xsl:template>
      
      <xsl:template match="source|blockquote">
        <xsl:choose>
      	<xsl:when test="name(..)='p'">
      	  <code>
      	    <xsl:value-of select="." />
      	  </code> 
      	</xsl:when>
        
      	<xsl:otherwise>
      	  <source>
      	    <xsl:value-of select="." />
      	  </source> 
      	</xsl:otherwise>
         </xsl:choose>
      </xsl:template>
  
      
      <!-- person to author -->
      <xsl:template match="author"/>
      
      <xsl:template match="section|s1|s2|s3|s4|s5|s6">
          <section>
            <title><xsl:value-of select="@name" /></title>
              <xsl:apply-templates/>
          </section>
      </xsl:template>
  
    
      <xsl:template match="subsection">
          <section>
            <title><xsl:value-of select="@name" /></title>
              <xsl:apply-templates/>
          </section>
      </xsl:template>
      
      <!-- convert a to link -->
      <xsl:template match="a">
        <xsl:if test="@name">
          <!-- Attach an id to the current node -->
          <xsl:attribute name="id"><xsl:value-of select="translate(@name, ' $', '__')"/></xsl:attribute>
          <xsl:apply-templates/>
        </xsl:if>
        <xsl:if test="@href">
          <link href="{@href}">
            <xsl:apply-templates/>
          </link>
        </xsl:if>
      </xsl:template>
      
      <xsl:template match="@valign | @align"/>
          
      <xsl:template match="center">
        <xsl:choose>
      	<xsl:when test="name(..)='p'">
      	    <xsl:apply-templates/>
      	</xsl:when>
        
      	<xsl:otherwise>
      	  <p>
      	    <xsl:apply-templates/>
      	  </p> 
      	</xsl:otherwise>
         </xsl:choose>
      </xsl:template>
  
      <xsl:template match="ol">
        <xsl:choose>
      	<xsl:when test="name(..)='p'">
      	   <xsl:text disable-output-escaping="yes"><![CDATA[</p>]]></xsl:text>
      	    <ol>
      	     <xsl:apply-templates/>
      	    </ol>
      	   <xsl:text disable-output-escaping="yes"><![CDATA[<p>]]></xsl:text>
      	</xsl:when>
        	<xsl:otherwise>
      	    <ol>
      	     <xsl:apply-templates/>
      	    </ol>
      	</xsl:otherwise>
         </xsl:choose>
      </xsl:template>
      
      <xsl:template match="ul">
        <xsl:choose>
      	<xsl:when test="name(..)='p'">
      	   <xsl:text disable-output-escaping="yes"><![CDATA[</p>]]></xsl:text>
      	    <ul>
      	     <xsl:apply-templates/>
      	    </ul>
      	   <xsl:text disable-output-escaping="yes"><![CDATA[<p>]]></xsl:text>
      	</xsl:when>
        	<xsl:otherwise>
      	    <ul>
      	     <xsl:apply-templates/>
      	    </ul>
      	</xsl:otherwise>
         </xsl:choose>
      </xsl:template>
          
      <xsl:template match="b">
        <strong>
          <xsl:value-of select = "."/>
        </strong>
      </xsl:template>
      
      <xsl:template match="i">
        <em>
          <xsl:value-of select = "."/>
        </em>
      </xsl:template>
  
      <xsl:template match="table">
        <table>
              <xsl:apply-templates select="node()"/>
        </table>
      </xsl:template>
      
              
      <xsl:template match="br">
        <xsl:choose>
  	    <xsl:when test="normalize-space(text())">
  	    	    
  		  <xsl:choose>
  		    <xsl:when test="name(..)='p'">
  		        <xsl:apply-templates/>
  		      <br/> 
  		    </xsl:when>
  	  	    <xsl:otherwise>
  		      <p>
  	            <xsl:apply-templates/>
  		      </p>
  		    </xsl:otherwise>
  	       </xsl:choose>
  	      
  	    </xsl:when>
    	    <xsl:otherwise>
  	      <br/>
  	    </xsl:otherwise>
         </xsl:choose>
      </xsl:template>
      
      <!-- Strip -->
      <xsl:template match="font">
        <xsl:apply-templates/>
      </xsl:template>
  
      <xsl:template match="h1|h2|h3|h4">
       <xsl:comment> -ATTENTION- THIS IS A SECTION, PLEASE ENCLOSE THE SECTION CONTENTS...
-ATTENTION- </xsl:comment>
       <section><title><xsl:apply-templates/></title> <xsl:comment>...
HERE! :-)</xsl:comment></section>
      </xsl:template>
                  
      <xsl:template match="node()|@*" priority="-1">
          <xsl:copy>
              <xsl:apply-templates select="node()|@*"/>
          </xsl:copy>
      </xsl:template>
  
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-forrest/scratchpad/convert/anakiaNmaven/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project name="Forrest Converter" default="convert" basedir=".">
  
      <property name="src.dir" location="${xdocs.dir}"/>
      <!--<property name="src.format" value="maven"/>
      <property name="target.format" value="forrest"/>-->
      <property name="dest.dir" value="${user.dir}/temp"/>
      <property name="converter.xsl" location="anakiaNmaven2document11.xsl"/>
      <property name="book2project.xsl" location="projectNnavigation2book.xsl"/>
  
      <target name="prepare" unless="xdocs.dir">
          <echo message="Need to specify absolute path in xdocs.dir"/>
          <echo message="property similar to"/>
          <echo message="ant -Dxdocs.dir=/opt/projects/jakarta-avalon-excalibur/bzip/src/xdocs"/>
          <fail/>
      </target>
  
      <target name="convert" depends="prepare">
  
          <style style="${converter.xsl}"
              force="true"
              basedir="${src.dir}"
              extension=".xml"
              destdir="${dest.dir}">
              <exclude name="**/project.xml"/>
              <include name="**/*.xml"/>
          </style>
  
  
          <mkdir dir="${dest.dir}/stylesheets" />
          
          <style style="${book2project.xsl}"
              force="true"
              basedir="${src.dir}"
              extension="-book.xml"
              destdir="${dest.dir}">
              <include name="**/project.xml"/>
          </style>
  
          <style style="${book2project.xsl}"
              force="true"
              basedir="${src.dir}"
              extension="-book.xml"
              destdir="${dest.dir}">
              <include name="**/navigation.xml"/>
          </style>
          
          <copy todir="${dest.dir}">
            <fileset dir="${src.dir}">
              <exclude name="**/*.xml"/>
            </fileset>
          </copy>         
  
          <copy file="${dest.dir}/stylesheets/project-book.xml" tofile="${dest.dir}/book.xml"
failonerror="false"/>
          <copy file="${dest.dir}/stylesheets/navigation-book.xml" tofile="${dest.dir}/book.xml"
failonerror="false"/>        
          <delete dir="${dest.dir}/stylesheets" />
          
          
          <copy file="${user.dir}/tabs.xml" todir="${dest.dir}"/>
                  
          <fixcrlf srcdir="${dest.dir}"
                  tab="remove"
                  tablength="4"
                  eol="crlf"
                  javafiles="no"
                  includes="**/*.xml"
           />
    
      </target>
  
      <target name="update" depends="convert">
          <copy todir="${src.dir}">
              <fileset dir="${dest.dir}"/>
          </copy>
          <delete dir="${dest.dir}"/>
      </target>
  
  </project>
  
  
  
  1.1                  xml-forrest/scratchpad/convert/anakiaNmaven/projectNnavigation2book.xsl
  
  Index: projectNnavigation2book.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
      <xsl:output method = "xml"  
                  version="1.0"
                  omit-xml-declaration="no" 
                  indent="yes"
                  encoding="ISO-8859-1"
                  doctype-system="book-cocoon-v10.dtd"
                  doctype-public="-//APACHE//DTD Cocoon Documentation Book V1.0//EN" />
  
      <!-- book to project -->
      <xsl:template match="project">
          <book software="{@name}"
              copyright="{@name}"
              title="{title}">
  
          <xsl:for-each select = "//menu">
            <menu label="{@name}">
              <xsl:for-each select = "item">
               <menu-item  label="{@name}" href="{@href}"/>
              </xsl:for-each>
            </menu> 
          </xsl:for-each>
  
          </book>
      </xsl:template>
  
      <xsl:template match="menu"/>
  
      <xsl:template match="item"/>
  
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-forrest/scratchpad/convert/anakiaNmaven/tabs.xml
  
  Index: tabs.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE tabs PUBLIC "-//APACHE//DTD Cocoon Documentation Tab V1.0//EN" "tab-cocoon-v10.dtd">
  
        <tabs software="MyProj"
          title="MyProj"
          copyright="Foo"
          xmlns:xlink="http://www.w3.org/1999/xlink">
  
          <tab label="Home" dir=""/>
          <!-- Add new tabs here, eg:
          <tab label="How-Tos" dir="community/howto/"/>
          <tab label="XML Site" dir="xml-site/"/>
          -->
  
      </tabs>
  
  

Mime
View raw message