antlets/makeantlet/src/resources/stylesheets xbuild2xdoc.xsl,1.1,1.2 properties2xdoc.xsl,1.2,1.3

[email protected] Wed, 10 Mar 2004 04:30:58 -0800
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/antlets/makeantlet/src/resources/stylesheets
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16072/makeantlet/src/resources/stylesheets

Modified Files:
	xbuild2xdoc.xsl properties2xdoc.xsl 
Log Message:
added ability to build a documentation portal using forrest.
uses makeantlet's capability to abstract information from the antlets

Index: xbuild2xdoc.xsl
===================================================================
RCS file: /cvsroot/metamorphosis/antlets/makeantlet/src/resources/stylesheets/xbuild2xdoc.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** xbuild2xdoc.xsl	2 Mar 2004 21:16:38 -0000	1.1
--- xbuild2xdoc.xsl	10 Mar 2004 12:30:56 -0000	1.2
***************
*** 1,103 ****
  <?xml version="1.0"?>
  <!--$Header$ -->
- <!-- TODO: migrate this to generate xdocs from the xbuild -->
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
! 
! 	<xsl:output method = "xml" doctype-public="-//APACHE//DTD Documentation V1.1//EN" doctype-system="./dtd/document-v11.dtd"/>
! 	<xsl:strip-space elements="project target"/>
! 	<xsl:param name="version">0.0</xsl:param>
! 	<xsl:template match="/">
! <document>
!   <header>
!     <title>XBuild description</title>
!     <authors>
!       <person id="AD" name="Antlet Documentation" />
!     </authors>
!   </header>
    
- 		<body>	
- 			<xsl:apply-templates select="project"/>
- 		</body>
- </document>
- 	</xsl:template>
- 	<xsl:template match="project">
- 		<xsl:variable name="name">
- 			<xsl:value-of select="@name"/>
- 		</xsl:variable>
- 		<section>
- 			<title>Project <xsl:value-of select="$name"/></title>
- 			<p>
- 			<xsl:value-of select="@description"/>
- 			<xsl:value-of select="description"/>
- 			</p>
- 			<p>
- 				<xsl:apply-templates select="." mode="previous-comment"/>
- 			</p>
- 			<!-- xsl:apply-templates select="property"/ -->
- 			<xsl:apply-templates select="target" mode="mainTargets"/>
- 		</section>
- 	</xsl:template>
    
- 	<xsl:template match="target" mode="mainTargets">
- 		<xsl:variable name="targetName">
- 			<xsl:value-of select="@name"/>
- 		</xsl:variable>
- 		<xsl:variable name="targetType">
- 			<xsl:choose>
- 				<xsl:when test="starts-with($targetName, '-')">
- 					<xsl:text>internal</xsl:text>
- 				</xsl:when>
- 				<xsl:when test="@description">
- 					<xsl:text>main</xsl:text>
- 				</xsl:when>
- 				<xsl:otherwise>
- 					<xsl:text>helper</xsl:text>
- 				</xsl:otherwise>
- 			</xsl:choose>
- 		</xsl:variable>
- 		<section>
- 			<title><xsl:value-of select="$targetName"/><xsl:text> </xsl:text>(<xsl:value-of select="$targetType"/>)</title>
- 			<p>
- 				<xsl:value-of select="@description"/>
- 			</p>
- 			<p>
- 				<xsl:apply-templates select="." mode="previous-comment"/>
- 			</p>
- 			<!-- xsl:apply-templates select="property"/ -->
- 		</section>
- 	</xsl:template>
- 	
    <xsl:template match="property">
! 		<property >
! 			<xsl:attribute name="name">
! 				<xsl:value-of select="@name"/>
! 			</xsl:attribute>
! 			<description>
! 				<xsl:apply-templates select="." mode="previous-comment"/>
! 			</description>
! 			<default>
! 				<xsl:value-of select="@value"/>
! 			</default>
! 		</property>
! 	</xsl:template>
    
! 	<xsl:template match="*" mode="previous-comment">
! 		<xsl:choose>
! 			<xsl:when
! 				test="preceding-sibling::node()[1] = preceding-sibling::comment()[1]"
! 				>
! 				<xsl:apply-templates select="preceding-sibling::comment()[1]" mode="previous-comment"/>
! 
! 				<xsl:value-of disable-output-escaping = "yes"
! 					select="normalize-space(preceding-sibling::comment()[1])"/>
! 			</xsl:when>
! 			<xsl:otherwise>
! 				<!--Preceding node: "<xsl:value-of select="preceding-sibling::node()[1]"/>"
!             Preceding *: "<xsl:value-of select="preceding-sibling::*[1]"/>"
!             Preceding comment: "<xsl:value-of select="preceding-sibling::comment()[1]"/>"
!             -->
! 			</xsl:otherwise>
! 		</xsl:choose>
! 	</xsl:template>
    
  </xsl:stylesheet>
--- 1,107 ----
  <?xml version="1.0"?>
  <!--$Header$ -->
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
!   <xsl:output method="xml" doctype-public="-//APACHE//DTD Documentation V1.1//EN" doctype-system="./dtd/document-v11.dtd"/>
!   <xsl:strip-space elements="project target"/>
!   
!   <xsl:template match="/">
!     <document>
!         <xsl:apply-templates select="project"/>
!     </document>
!   </xsl:template>  
!   
!   
!   <xsl:template match="project">  
!     <header>
!       <title><xsl:value-of select="@name"/></title>
!       <authors>
!         <person id="AD" name="Antlet Documentation" email="[email protected]"/>
!       </authors>
!     </header>
!     <body>
!       <p>
!        <xsl:if test="@description or description">
!          <strong>Description:</strong>
!          <xsl:value-of select="@description"/>
!          <xsl:value-of select="description"/>
!        </xsl:if>   
!       </p>
!       <section>
!         <title>Main Targets</title> 
!         <xsl:apply-templates select="target">          
!           <xsl:with-param name="target-filter" select="'main'" />
!         </xsl:apply-templates>  
!       </section>
!       <section>
!         <title>Helper Targets</title>
!         <xsl:apply-templates select="target">          
!         <xsl:with-param name="target-filter" select="'helper'" />
!         </xsl:apply-templates>   
!       </section>
!       <section>
!         <title>Internal Targets</title>
!         <xsl:apply-templates select="target">          
!         <xsl:with-param name="target-filter" select="'internal'" />
!         </xsl:apply-templates>    
!       </section>
!       <section>
!         <title>internal Properties</title> 
!         <!-- xsl:apply-templates select="property"/ -->
!       </section>
!     </body> 
!   </xsl:template> 
!    
!   
!   <xsl:template match="target">    
!     <xsl:param name="target-filter" select="'main'" />
!     <xsl:variable name="targetType">
!       <xsl:choose>
!         <xsl:when test="starts-with(@name, '-')">
!           <xsl:text>internal</xsl:text>
!         </xsl:when>
!         <xsl:when test="@description">
!           <xsl:text>main</xsl:text>
!         </xsl:when>
!         <xsl:otherwise>
!           <xsl:text>helper</xsl:text>
!         </xsl:otherwise>
!       </xsl:choose>
!     </xsl:variable>
!     
!     <xsl:if test="$target-filter=$targetType">
!       <p />
!       <table>
!         <tr><td><strong><xsl:value-of select="@name"/></strong></td></tr>
!         <tr><td><em>Description:</em><xsl:value-of select="@description"/>&#160;</td></tr>
!         <tr><td><em>Comment:</em><xsl:call-template name="get-comment"/>&#160;</td></tr>    
!       </table>
!     </xsl:if>
!     <!-- xsl:apply-templates select="property"/ -->
!   </xsl:template>  
    
    
    <xsl:template match="property">
!     <property>
!       <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
!       <description>
!        <xsl:call-template name="get-comment"/>
!       </description>
!       <default>
!         <xsl:value-of select="@value"/>
!       </default>
!     </property>
!   </xsl:template>  
    
!   <xsl:template name="get-comment">   
!   	<xsl:param name="count" select="1"/>
!   	<xsl:variable name="mynode" select="preceding-sibling::comment()[$count]"/>
!     <xsl:if test="preceding-sibling::node()[$count] = $mynode">
!        <xsl:value-of disable-output-escaping="yes" select="normalize-space(translate($mynode,'=',''))"/>
!        <xsl:call-template name="get-comment">
! 		<xsl:with-param name="count" select="$count+1" />
!        </xsl:call-template>
!     </xsl:if>
!   </xsl:template>  
    
  </xsl:stylesheet>
+ 

Index: properties2xdoc.xsl
===================================================================
RCS file: /cvsroot/metamorphosis/antlets/makeantlet/src/resources/stylesheets/properties2xdoc.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** properties2xdoc.xsl	3 Mar 2004 21:02:53 -0000	1.2
--- properties2xdoc.xsl	10 Mar 2004 12:30:56 -0000	1.3
***************
*** 1,49 ****
  <?xml version="1.0"?>
! <!-- TODO: this stylesheet is not working
! 	 finish the style sheet to output the properties and their comments
!      in xdoc format -->
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
! 
! 	<xsl:output method = "xml" doctype-public="-//APACHE//DTD Documentation V1.1//EN" doctype-system="./dtd/document-v11.dtd"/>
! 	<xsl:strip-space elements="project target"/>
! 	<xsl:param name="version">0.0</xsl:param>
! 	<xsl:template match="/">
! <document>
!   <header>
!     <title>Properties</title>
!     <authors>
!       <person id="AD" name="Antlet Documentation" />
!     </authors>
!   </header>
!   
! 		<body>	
! 			<section><title>Properties</title>
! 			
! 			<xsl:apply-templates select="*">
! 				<xsl:with-param name="property"><xsl:value-of select="name()"/></xsl:with-param>
! 			</xsl:apply-templates>
! 			</section>
! 		</body>
! </document>
! 	</xsl:template>
! 	
! 	<xsl:template match="*">
! 		level up
! 		<xsl:param name="property"/>
! 		<xsl:value-of select="$property"/>
! 		
! 		<xsl:choose>
! 			<xsl:when test="text()">
! 				<xsl:value-of select="$property"/> : <xsl:value-of select="text()"/>
! 			</xsl:when>
! 			<xsl:otherwise>
! 			</xsl:otherwise>
! 		</xsl:choose>
! 				<xsl:variable name="test"><xsl:value-of select="$property"/>.<xsl:value-of select="name()"/></xsl:variable>
! 				<xsl:apply-templates select="*">
! 					<xsl:with-param name="property" select="$test"/>
! 				</xsl:apply-templates>
! 		level down
! 	</xsl:template>
    
  </xsl:stylesheet>
--- 1,46 ----
  <?xml version="1.0"?>
! <!-- style sheet to output the 'public' properties and their comments in xdoc format -->
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
!   <xsl:output method="xml" doctype-public="-//APACHE//DTD Documentation V1.1//EN" doctype-system="./dtd/document-v11.dtd"/>
!   <xsl:strip-space elements="project target"/>
!   <xsl:param name="version">0.0</xsl:param>
!   <xsl:template match="/">
!     <document>
!       <header>
!         <title>Properties</title>
!         <authors>
!           <person id="AD" name="Antlet Documentation" email="[email protected]"/>
!         </authors>
!       </header>
!       <body>
!         <table>
!           <tr>
!             <th>Name</th>
!             <th>Default Value</th>
!             <th>Comment</th>
!           </tr>
!           <xsl:for-each select="*">
!               <xsl:call-template name="find-property"/>
!           </xsl:for-each>
!           </table>
!       </body>
!     </document>
!   </xsl:template>
    
+     <xsl:template name="find-property">
+     <xsl:param name="prop-path"/>
+     <xsl:for-each select="*">
+       <xsl:call-template name="find-property">
+         <!--xsl:with-param name="prop-path" select="concat($property-path,'.',name())"/-->
+         <xsl:with-param name="prop-path" select="concat($prop-path,substring('.', 1, boolean($prop-path) * 1),name())"/>
+       </xsl:call-template>
+     </xsl:for-each>
+     <xsl:if test="text() and not(*)">
+       <tr>
+         <td><strong><xsl:value-of select="$prop-path"/></strong></td>
+         <td><code><xsl:value-of select="text()" /></code></td>
+         <td>&#160;</td>
+       </tr>
+     </xsl:if>
+   </xsl:template>
  </xsl:stylesheet>



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click