<?xml version="1.0" encoding="utf8"?>
<!--
$Id: data-blocks.xsl,v 1.11 2005/08/23 03:06:58 jmates Exp $

The author disclaims all copyrights and releases this document into
the public domain.

Stylesheet to extract out shell commands from eolas documents.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
  <xsl:output method="text"/>
  <xsl:strip-space elements="*"/>
  <xsl:param name="default.uri"/>
  <xsl:variable name="newline">
    <xsl:text>
</xsl:text>
  </xsl:variable>
  <xsl:template match="eolas">
    <xsl:text>Data block examples from "</xsl:text>
    <xsl:value-of select="summary/title"/>
    <xsl:text>"</xsl:text>
    <xsl:value-of select="$newline"/>
    <xsl:text>Source: http://sial.org</xsl:text><xsl:value-of select="$default.uri"/>
    <xsl:value-of select="$newline"/>
    <xsl:value-of select="$newline"/>
    <xsl:for-each select="//data">
      <xsl:for-each select="line|shell">
        <xsl:if test="@prefix">
          <xsl:value-of select="@prefix"/>
        </xsl:if>
        <xsl:choose>
          <xsl:when test="name()='shell'">
            <xsl:apply-templates/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="not(position()=last())">
          <xsl:value-of select="$newline"/>
        </xsl:if>
      </xsl:for-each>
      <xsl:value-of select="$newline"/>
      <xsl:if test="not(position()=last())">
        <xsl:value-of select="$newline"/>
        <xsl:value-of select="$newline"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
