Re: Re: [xsl] creating sequence diagrams for stylesheets

Subject: Re: Re: [xsl] creating sequence diagrams for stylesheets
From: Roland Lechner <roland_lechner@xxxxxx>
Date: Mon, 25 Feb 2002 16:49:22 +0100
of course, here it comes!

I am very grateful for advices, a.s.o!

It would be nice to create a graphical output too!

stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Gives you information about the input stylesheet -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
	<xsl:output method="xml"/>
	<!--............................................................................................. -->
	<!-- matches the start node wich is  <xsl:stylesheet>-->
	<xsl:template match="xsl:stylesheet" >
		<xsl:param name="href_self" select="''"/>
	
		<STYLESHEET>
			
			<xsl:attribute  name = "href" >
				<xsl:value-of select="$href_self" />
			</xsl:attribute>
		
				<GLOBAL_VARIABLES>	
					<xsl:apply-templates select="xsl:variable"/>
					<xsl:apply-templates select="xsl:param"/>
				</GLOBAL_VARIABLES>
				<APPLY_TEMPLATES>
					<xsl:apply-templates select="//*/xsl:apply-templates"/>
				</APPLY_TEMPLATES>
				<CALL_TEMPLATES>	
					<xsl:apply-templates select="//*/xsl:call-template"/>
				</CALL_TEMPLATES>	
				<TEMPLATES>	
					<xsl:apply-templates select="//*/xsl:template"/>
				</TEMPLATES>	
				<INCLUDED_STYLESHEETS>	
					<xsl:apply-templates select="//*/xsl:include"/>
				</INCLUDED_STYLESHEETS>
				
		</STYLESHEET>
	</xsl:template>
	<!--............................................................................................. -->
	<!-- matches the includes-->
	<xsl:template match="xsl:include">
<!--	<xsl:variable name = "included_document" select = "document(@href, document(''))" />	 -->
	
	<xsl:variable name = "included_document" select = "document(@href)" />
	<xsl:variable name = "href" select = "@href" />
<!--	<xsl:call-template name = "start_node" >
			<xsl:with-param name="href_self"><xsl:value-of select="$href" /></xsl:with-param>
		</xsl:call-template> -->
		
	<!--
		<xsl:value-of select="$href" />
		<xsl:value-of select="$included_document" /> -->
			<xsl:apply-templates select = "$included_document//xsl:stylesheet">
				<xsl:with-param name="href_self" select="$href"/>
			</xsl:apply-templates>	
	</xsl:template>
	<!--............................................................................................. -->
	<!-- matches the <xsl:apply-templates> -->
	<xsl:template match="xsl:apply-templates">
		<APPLY_TEMPLATE>
			<xsl:attribute  name = "select"><xsl:value-of select="@select" /></xsl:attribute>
			<PARAMETERS_USED>
		
				<xsl:apply-templates select="xsl:with-param"/>
			</PARAMETERS_USED>
		</APPLY_TEMPLATE>
	</xsl:template>
	<!--............................................................................................. -->
	<!-- matches the <xsl:call-template> -->
	<xsl:template match="xsl:call-template">
	<CALL_TEMPLATE>
		<xsl:attribute  name = "name" >
			<xsl:value-of select="@name"/>
		</xsl:attribute><PARAMETERS_USED>
				<xsl:apply-templates select="xsl:with-param"/>
		</PARAMETERS_USED>
		</CALL_TEMPLATE>
	</xsl:template>
	<!--............................................................................................. -->
	<!-- matches the <xsl:with:param> -->
	<xsl:template match="xsl:with-param">
		<PARAMETER>
			<xsl:attribute  name = "name" >
				<xsl:value-of select="@name"/>
			</xsl:attribute>
			<xsl:attribute  name = "select" >
				<xsl:choose>
					<xsl:when test="@select">
						<xsl:value-of select="@select"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="."/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
		</PARAMETER>
	</xsl:template>
<!--............................................................................................. -->
	<!-- matches the <xsl:template> -->
	<xsl:template match="xsl:template">
		<TEMPLATE>
		<xsl:attribute  name = "name" >
			<xsl:value-of select="@name"/>
		</xsl:attribute>
		<xsl:attribute  name = "match" >
			<xsl:value-of select="@match"/>
		</xsl:attribute>
				<PARAMETERS_USED><xsl:apply-templates select="xsl:param"/></PARAMETERS_USED>
				<VARIABLES_USED><xsl:apply-templates select="xsl:variable"/></VARIABLES_USED>
		</TEMPLATE>
	</xsl:template>
	
<!--............................................................................................. -->
	<!-- matches the <xsl:param> -->
	<xsl:template match="xsl:param">
		<PARAMETER>
		<xsl:attribute  name = "name" >
			<xsl:value-of select="@name"/>
		</xsl:attribute>
		<xsl:attribute  name = "select" >
		
					<xsl:choose>
						<xsl:when test="@select">
							<xsl:value-of select="@select"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="."/>
						</xsl:otherwise>
					</xsl:choose>
		</xsl:attribute>
		</PARAMETER>
	</xsl:template>
<!--............................................................................................. -->
	<!-- matches the <xsl:variable> -->
	<xsl:template match="xsl:variable">
		<VARIABLE>
		<xsl:attribute  name = "name" >
			 	<xsl:value-of select="@name" />
			 </xsl:attribute>  
				<xsl:attribute  name = "select" >
				<xsl:choose>
					<xsl:when test="@select">
						<xsl:value-of select="@select"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="."/>
					</xsl:otherwise>
				</xsl:choose>
				</xsl:attribute>
		</VARIABLE>
	</xsl:template> 
</xsl:stylesheet>


Roland

> Hello Roland,
> 
> Would you be willing to share the documentation stylesheet you wrote
> with the list.  I would find it usefull.
> 
> Thank You and Best Regards,
> 
> Saverio Perugini

______________________________________________________________________________
Darf es ein bisschen mehr sein? Mehr Speicher, mehr Mail, mehr Erlebnis, 
mehr Leistung, mehr Prämie unter http://club.web.de/?mc=021102


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread