<?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:ht = "http://www.w3.org/1999/xhtml"
  xmlns:d = "http://herbaer.de/xmlns/20051201/doc"
  xmlns = "http://www.w3.org/1999/xhtml"
  exclude-result-prefixes = "d ht"
  version = "1.0"
>
<d:info xmlns="http://herbaer.de/xmlns/20051201/doc">
  <title>desktop_help_pre.xslt</title>
  <subtitle>Die Hilfe zur Darstellung "desktop" 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,
nicht-leere Bildverweise werden am Ende des Inhalts
als leere Elemente angefügt.
</d:para>
<xsl:template match="*">
  <xsl:copy>
    <xsl:apply-templates select="@* | * | text()"/>
    <xsl:apply-templates select="ht:span [@class= 'imglink' and string-length(.) &gt; 0]" mode="append"
    />
  </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>
Nicht-leere Bildverweise werden aus dem laufenden Text entfernt.
</d:para>
<xsl:template match="ht:span [@class= 'imglink' and string-length(.) &gt; 0]">
  <xsl:apply-templates/>
</xsl:template>

<d:para>
Nicht-leere Bildverweise werden ohne Inhalt
am Ende des Inhalts des Elternelements angehängt
und bekommen das Attribut <d:code>@class = "ximglink"</d:code>.
</d:para>
<xsl:template match="ht:span" mode="append">
  <xsl:copy>
    <xsl:apply-templates select="@*" mode="append"/>
  </xsl:copy>
</xsl:template>

<d:para>
Bildverweise, die in der Quelle nicht leer sind,
bekommen im Modus "append" das Attribut <d:code>@class = "ximglink"</d:code>.
</d:para>
<xsl:template match="@class" mode="append">
  <xsl:attribute name="class">ximglink</xsl:attribute>
</xsl:template>

<d:para>
Andere Attribute werden kopiert.
</d:para>
<xsl:template match="@*" mode="append">
  <xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>
