<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0">
<title>Unit test: programlisting.012</title>

<para>A program listing for the language “none”.</para>

<programlisting language="none">ProgramListing: This is a test
  Only a test.
Had this been a real emegency,
  We would have fled in terror
And you would not have been informed.</programlisting>

<para>A program listing for the language “python” (explicitly).</para>

<programlisting language="python">    def _check_arg(self, arg):
        if ":" in arg:
            pos = arg.index(":")
            name = arg[0:pos]
            value = arg[(pos + 1):]
            if name in ("-x", "-y", "-r", "-init"):
                raise JavaClassRunnerException(
                    f"The {arg} option cannot be specified")
            if name == "-catalog":
                self.catalogs.append(value)
                return
            elif name == "-xsl":
                self.stylesheet = arg
        self._app_args.append(arg)</programlisting>

<para>A program listing without a language specification.</para>

<programlisting>    def _check_arg(self, arg):
        if ":" in arg:
            pos = arg.index(":")
            name = arg[0:pos]
            value = arg[(pos + 1):]
            if name in ("-x", "-y", "-r", "-init"):
                raise JavaClassRunnerException(
                    f"The {arg} option cannot be specified")
            if name == "-catalog":
                self.catalogs.append(value)
                return
            elif name == "-xsl":
                self.stylesheet = arg
        self._app_args.append(arg)</programlisting>

<para>A program listing for the language “xml”</para>

<programlisting language="xml"><![CDATA[<xsl:function name="f:verbatim-trim-trailing" as="xs:boolean">
  <xsl:param name="context" as="element()"/>
  <xsl:variable name="pi" select="f:pi($context, 'verbatim-trim-trailing')"/>
  <xsl:sequence select="if ($pi)
                        then f:is-true($pi)
                        else f:is-true($verbatim-trim-trailing-blank-lines)"/>
</xsl:function>]]></programlisting>

<para>A program listing for the language “xslt”</para>

<programlisting language="xslt"><![CDATA[<xsl:function name="f:verbatim-trim-trailing" as="xs:boolean">
  <xsl:param name="context" as="element()"/>
  <xsl:variable name="pi" select="f:pi($context, 'verbatim-trim-trailing')"/>
  <xsl:sequence select="if ($pi)
                        then f:is-true($pi)
                        else f:is-true($verbatim-trim-trailing-blank-lines)"/>
</xsl:function>]]></programlisting>

</article>
