<?xml version="1.0"?>
<?xml-stylesheet href="/pool/xslt_ht.xslt" type="application/xml"?>
<xsl:stylesheet
  xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
  xmlns:is = "http://herbaer.de/xmlns/20080705/imgshow"
  xmlns:d = "http://herbaer.de/xmlns/20051201/doc"
  xmlns = "http://herbaer.de/xmlns/20080705/imgshow"
  exclude-result-prefixes = "d is"
  version = "1.0"
>
<d:info xmlns="http://herbaer.de/xmlns/20051201/doc">
  <title>imgshow_pre.xslt</title>
  <subtitle>Eine Bildergeschichte für die Übersetzung vorbereiten</subtitle>
  <date>2015-08-12</date>
  <author>
    <personname>
      <firstname>Herbert</firstname>
      <surname>Schiemann</surname>
    </personname>
    <email>h.schiemann@herbaer.de</email>
  </author>
</d:info>

<xsl:output method="xml" encoding="utf-8"/>

<xsl:template match="/">
  <xsl:apply-templates select="text() | processing-instruction() | comment() | *"/>
</xsl:template>

<d:para>
Elemente werden "hohl" kopiert.
</d:para>
<xsl:template match="*">
  <xsl:copy>
    <xsl:apply-templates select="@* | * | text()"/>
  </xsl:copy>
</xsl:template>

<d:para>
Verarbeitungsanweisungen und Attribute werden kopiert
</d:para>
<xsl:template match="processing-instruction() | @*">
  <xsl:copy-of select="."/>
</xsl:template>

<d:para>
Bildverweise werden aus dem laufenden Text entfernt
und am Ende des Abschnitts angefügt.
</d:para>
<xsl:template match="is:p">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
    <xsl:apply-templates select="is:jpg" mode="append"/>
  </xsl:copy>
</xsl:template>

<d:para>
Bildverweise werden aus dem laufenden Text entfernt.
</d:para>
<xsl:template match="is:jpg">
  <xsl:apply-templates/>
</xsl:template>

<d:para>
Bildverweise werden ohne Inhalt am Ende des Abschnitts angefügt.
</d:para>
<xsl:template match="is:jpg" mode="append">
  <xsl:copy>
    <xsl:apply-templates select="@*"/>
  </xsl:copy>
</xsl:template>

<d:para>
Das Wort <d:literal>wttl</d:literal> wird aus dem Wert des Attributs
<d:tag class="attribute">is:jpg/@alt</d:tag> entfernt.
</d:para>
<xsl:template match="is:jpg/@alt">
  <xsl:attribute name="alt">
    <xsl:choose>
      <xsl:when test="contains (., 'wttl')">
        <xsl:value-of
          select = "
            normalize-space (
            concat (substring-before (., 'wttl'), ' ', substring-after (., 'wttl')) )
          "
        />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="."/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:attribute>
</xsl:template>

</xsl:stylesheet>
