<?xml version="1.0" encoding="ISO-8859-1"?>

<!--
 * Einfacher XML Translator fuer Fremdformate
 *
 * $Revision: 1.7 $
 * $Source: /cvsroot/selflinux/interna/xml/main.xsl,v $
 *
 * Diese Datei ist Teil von SelfLinux  http://www.selflinux.de
 *
 *** $Id: main.xsl,v 1.7 2002/07/30 21:00:55 jkolb Exp $
-->
  
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:saxon="http://icl.com/saxon"
		extension-element-prefixes="saxon">
 
 
<xsl:template match="/">
	<xsl:apply-templates/>
</xsl:template>


<!-- globals -->
<xsl:variable name="filename">
	<xsl:value-of select="chapter/@id"/>
</xsl:variable>
<!-- end of globals -->

<xsl:template match="chapter">

	<saxon:output method="xml"
              href="{$filename}"
              encoding="ISO-8859-1"
              indent="yes">

                <chapter runlevel="user">
		<xsl:apply-templates select="title"/>
		<xsl:apply-templates select="docinfo"/>

                <split>
                  <section>
                    <heading><xsl:value-of select="$filename"/></heading>
		    <xsl:apply-templates select="para"/>
                  </section>
		</split>

                <split>
		<xsl:apply-templates select=
			"*[not(self::title or self::docinfo or self::para)]"/>
		</split>
                </chapter>
        </saxon:output>
</xsl:template>

<xsl:template match="docinfo">
	<cvs>
		<name>$Name:  $</name>
		<id>$Id: $</id>
		<revision>$Revision: 1.2.2.9 $</revision>
		<source>$Source: $</source>
		<!-- trash away foreign header -->
	</cvs>
</xsl:template>

<xsl:template match="chapter/title">
	<title><xsl:apply-templates/></title>
        <index><xsl:value-of select="$filename"/></index>
</xsl:template>

<xsl:template match="para">
	<textblock><xsl:apply-templates/></textblock>
</xsl:template>

<xsl:template match="footnote">
	[footnote]<xsl:apply-templates/>[/footnote]
</xsl:template>

<xsl:template match="xref">
	<ref iref="DUMMY"><xsl:value-of select="@*"/></ref>
</xsl:template>

<xsl:template match="sect1">
	<section><xsl:apply-templates/></section>
</xsl:template>

<xsl:template match="sect2">
	<section><xsl:apply-templates/></section>
</xsl:template>

<xsl:template match="sect1/title">
	<heading><xsl:apply-templates/></heading>
</xsl:template>

<xsl:template match="sect2/title">
	<heading><xsl:apply-templates/></heading>
</xsl:template>

<xsl:template match="option">
	<command><xsl:apply-templates/></command>
</xsl:template>

<xsl:template match="para/userinput">
	<command><xsl:apply-templates/></command>
</xsl:template>

<xsl:template match="screen">
	<shell>
		<xsl:apply-templates select="userinput"/>
		<output><xsl:apply-templates select="text()"/></output>
	</shell>
</xsl:template>

<xsl:template match="screen/prompt">
	<!-- trash -->
</xsl:template>

<xsl:template match="screen/userinput">
	<user path="~"><xsl:apply-templates/></user>
</xsl:template>
		
</xsl:stylesheet>

