antlets/makeantlet/src/resources/stylesheets xbuild2xdoc.xsl,NONE,1.1 properties2xdoc.xsl,NONE,1.1 xbuild2usage.xsl,NONE,1.1

[email protected] Tue, 02 Mar 2004 13:16:41 -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-serv2412/makeantlet/src/resources/stylesheets

Added Files:
	xbuild2xdoc.xsl properties2xdoc.xsl xbuild2usage.xsl 
Log Message:
standardising antlets

--- NEW FILE: xbuild2xdoc.xsl ---
<?xml version="1.0"?>
<!--$Header: /cvsroot/metamorphosis/antlets/makeantlet/src/resources/stylesheets/xbuild2xdoc.xsl,v 1.1 2004/03/02 21:16:38 homeijer Exp $ -->
<!-- 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>

--- NEW FILE: properties2xdoc.xsl ---
<?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="nodename()"/></xsl:with-param>
			</xsl:apply-templates>
			</section>
		</body>
</document>
	</xsl:template>
	
	<xsl:template match="*">
		<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:apply-templates select="*">
					<xsl:with-param name="property"><xsl:value-of select="$property"/>.<xsl:value-of select="name()"/></xsl:with-param>
				</xsl:apply-templates>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
  
</xsl:stylesheet>

--- NEW FILE: xbuild2usage.xsl ---
<?xml version="1.0"?>
<!--$Header: /cvsroot/metamorphosis/antlets/makeantlet/src/resources/stylesheets/xbuild2usage.xsl,v 1.1 2004/03/02 21:16:38 homeijer Exp $ -->
<!-- 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"/>
	<!-- xsl:strip-space elements="project target"/ -->
	<xsl:param name="version">0.0</xsl:param>
	<xsl:template match="project">
	<project>
		<xsl:attribute name="default"><xsl:value-of select="@name"/>.usage</xsl:attribute>
		<xsl:attribute name="name"><xsl:value-of select="@name"/>.usage</xsl:attribute>
		<description>Show the usage of the <xsl:value-of select="@name"/> build.
		</description>
		
		<target description="Show usage">
			<xsl:attribute name="name"><xsl:value-of select="@name"/>.usage</xsl:attribute>
		  	<echo>
			<xsl:apply-templates select="." mode="previous-comment"/>
			
			<xsl:apply-templates select="target" mode="mainTargets"/>
			</echo>
		</target>
	</project>
	</xsl:template>
  
	<xsl:template match="target" mode="mainTargets">
		<xsl:variable name="targetName">
			<xsl:value-of select="@name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="starts-with($targetName, '-')">
			</xsl:when>
			<xsl:when test="@description">
Target : <xsl:value-of select="$targetName"/>				
<xsl:text>
</xsl:text>
<xsl:value-of select="@description"/>
<xsl:text>
</xsl:text>
				<xsl:apply-templates select="." mode="previous-comment"/>
			</xsl:when>
		</xsl:choose>
	</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:text>
				</xsl:text>
<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>



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click