<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="/pool/xslt_ht.xslt" type="application/xml"?>
<xsl:stylesheet
  xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
  xmlns:d = "http://herbaer.de/xmlns/20051201/doc"
  version = "1.0"
  xml:lang = "de"
>

<d:info xmlns="http://herbaer.de/xmlns/20051201/doc">
  <title>add_sspi.xslt</title>
  <subtitle>Stylesheet-Verarbeitungsanweisung einfügen</subtitle>
  <date>2017-05-24</date>
  <author>
    <personname>
      <firstname>Herbert</firstname>
      <surname>Schiemann</surname>
    </personname>
    <email>h.schiemann@herbaer.de</email>
  </author>
</d:info>

<d:para role="stylesheet">
Diese Transformation fügt eine
<d:literal>xml-stylesheet</d:literal> - Verarbeitungsanweisung ein,
wenn es eine solche nicht gibt.
</d:para>

<d:para>
Verweis auf die Transformation
</d:para>
<xsl:param name="p_ss" select="'s/kal.xslt'"/>

<xsl:template match="/">
  <xsl:if test="not (processing-instruction() [name() = 'xml-stylesheet'])">
    <xsl:processing-instruction name="xml-stylesheet">
      <xsl:text>href="</xsl:text>
      <xsl:value-of select="$p_ss"/>
      <xsl:text>" type="application/xml"</xsl:text>
    </xsl:processing-instruction>
  </xsl:if>
  <xsl:apply-templates select="* | processing-instruction()"/>
</xsl:template>

<d:para>
Elemente werden kopiert.
</d:para>
<xsl:template match="*">
  <xsl:copy-of select="."/>
</xsl:template>

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

</xsl:stylesheet>
