<?xml version="1.0" encoding="utf-8"?>

<xslt:stylesheet version="1.0"
				xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
				xmlns="http://www.w3.org/1999/xhtml"
				xmlns:doc="http://www.linkwerk.com/namespaces/2005-02-03/xsltdoc/output/"
				xmlns:xsltdoc="http://www.linkwerk.com/namespaces/2005-02-03/xsltdoc/"
                >

   <!-- ====================================================
        xsltdoc.xslt, (c) 2005 Linkwerk.com, Stefan Mintert, All rights reserved.
        Check http://www.linkwerk.com/pub/xslt/lib/xsltdoc/ for legal information.
        In no case may this copyright notice be removed.

	$Revision: 1.4 $
        ====================================================
   -->

	<!-- ======================================================== -->
	<!-- Print doc:-elements                                      -->
	<!-- ======================================================== -->

        <xslt:template match="doc:*"> 
		<xslt:element name="{local-name()}">
		  <xslt:for-each select="@doc:*">
	                <xslt:attribute name="{local-name()}"><xslt:value-of select="."/></xslt:attribute>
		  </xslt:for-each>
                  <xslt:apply-templates/>
		</xslt:element>
        </xslt:template>

        <!-- ======================================================== -->
        <!-- Process xsltdoc:-elements                                -->
        <!-- ======================================================== -->

        <xslt:template match="xsltdoc:displaySource">
		<xslt:apply-templates select="//xslt:*[@xsltdoc:id = current()/@xsltdoc:idref]"/>
        </xslt:template>

        <xslt:template match="xsltdoc:containerend">
		<xslt:text disable-output-escaping="yes"><![CDATA[</]]></xslt:text>
		<xslt:value-of select="@xsltdoc:type"/>
		<xslt:text disable-output-escaping="yes"><![CDATA[>]]></xslt:text>
        </xslt:template>
        <xslt:template match="xsltdoc:containerstart">
                <xslt:text disable-output-escaping="yes"><![CDATA[<]]></xslt:text>
                <xslt:value-of select="@xsltdoc:type"/>
		<xslt:for-each select="xsltdoc:attribute">
			<xslt:text> </xslt:text>
			<xslt:value-of select="@xsltdoc:name"/>
			<xslt:text>="</xslt:text>
			<xslt:value-of select="@xsltdoc:value"/>
			<xslt:text>"</xslt:text>
		</xslt:for-each>
                <xslt:text disable-output-escaping="yes"><![CDATA[>]]></xslt:text>
        </xslt:template>

        <xslt:template match="@xsltdoc:*" />

        <!-- ======================================================== -->
        <!-- Mode: stripdoc                                           -->
        <!-- ======================================================== -->

	<xslt:template match="doc:*|@doc:*|xsltdoc:*|@xsltdoc:*" mode="stripdoc" />

	<xslt:template match="@*|node()" mode="stripdoc">
	  <xslt:copy>
	    <xslt:apply-templates select="@*|node()" mode="stripdoc"/>
	  </xslt:copy>
	</xslt:template>

        <!-- ======================================================== -->
        <!-- Start processing, call output specific start-template    -->
        <!-- ======================================================== -->

        <!--
             Parameter xsltdoc-mode
             Possible values: "gendoc"    - Produce documentation output
                              "stripdoc"  - Remove documentation from XSLT input
        -->
        <xslt:param name="xsltdoc-mode">gendoc</xslt:param>

        <xslt:template match="/">
		<xslt:comment>Generated by xsltdoc.xslt, (c) Linkwerk.com 2005, Do not remove this copyright note, www.linkwerk.com/pub/xslt/lib/xsltdoc/</xslt:comment>
          <xslt:choose>
           <xslt:when test="$xsltdoc-mode = 'gendoc'">
		<xslt:call-template name="xsltdoc-start"/>
           </xslt:when>
           <xslt:when test="$xsltdoc-mode = 'stripdoc'">
                <xslt:apply-templates select="*" mode="stripdoc"/>
           </xslt:when>
           <xslt:otherwise>
                <xslt:message terminate="yes">Unknown Mode: <xslt:value-of select="$xsltdoc-mode"/></xslt:message>
           </xslt:otherwise>
          </xslt:choose>
        </xslt:template>

</xslt:stylesheet>
