// Listings aus dem Artikel
// "Nicht ohne einen Namen" von Stefan Mintert
// iX 4/2005, S. 135


!!! Listing 1: Namensraum-Festlegung

<?xml version="1.0" encoding="utf-8"?>
<xslt:stylesheet 
      version="1.0"
      xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
      xmlns:doc="http://www.linkwerk.com/namespaces/2005-02-03/xsltdoc/output/">
        <doc:title>Some documentation ...</doc:title>
        <doc:para>Some more documentation ...</doc:para>
        <xslt:template match="*">
            <xslt:apply-templates/>
        </xslt:template>
</xslt:stylesheet>


!!! Listing 2: doc-Template

<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>

!!! Listing 3: HTML-Dokumentation

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

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

  <!-- The Root node  -->
  <doc:div doc:class="templatedoc">
    <doc:h2 doc:style="text-align: center">The Template for the Root-Node</doc:h2>

    <doc:p>This template generates the basic XHTML elements,
    i.e. html, head, title, body. It places the contents of the source
    XML within the XHTML-body by applying the appropriate
    templates. </doc:p>

  </doc:div>

  <xslt:template match="/">
    <html><head><title>Hello World XSLT</title></head>
      <body>
        <xslt:apply-templates/>
      </body>
    </html>
  </xslt:template>

  <!-- someElement -->
  <doc:div doc:class="templatedoc">
    <doc:h2>Template for someElement</doc:h2>
    <doc:p>The processing of elements of type
      <doc:kbd>someElement</doc:kbd> is very sophisticated. Let us first
      take a look at the template code:</doc:p>
  </doc:div>

  <xslt:template match="someElement">
      ...
  </xslt:template>

  <doc:div doc:class="templatedoc">

    <doc:p>As you can see the key for understanding this complex
    template is the XPath expression in the match attribute.</doc:p>

    <doc:p>Much more documentation of this highly fascinating template
    goes here...</doc:p>
  </doc:div>

</xslt:stylesheet>
