diff --git a/Doc/Sda1/xslt.xml b/Doc/Sda1/xslt.xml index 45e623f6548641f69de624c8819a50153bf401b4..b0856ee3f042da612c5f5d8e689effd6df688440 100644 --- a/Doc/Sda1/xslt.xml +++ b/Doc/Sda1/xslt.xml @@ -9,45 +9,48 @@ xmlns:db="http://docbook.org/ns/docbook"> <title>The Extensible stylesheet Language XSL</title> - <para>XSL is a <link xlink:href="https://www.w3.org/Style/XSL">W3C - standard</link> which defines a language to transform XML documents into the - following output formats:</para> - - <itemizedlist> - <listitem> - <para>Ordinary text e.g in <link - xlink:href="http://unicode.org">Unicode</link> encoding.</para> - </listitem> - - <listitem> - <para>XML.</para> - </listitem> - - <listitem> - <para>HTML</para> - </listitem> - - <listitem> - <para>XHTML</para> - </listitem> - </itemizedlist> - - <para>Transforming a source XML document into a target XML document may be - required if:</para> - - <itemizedlist> - <listitem> - <para>The target document expresses similar semantics but uses a - different XML dialect i.e. different tag names.</para> - </listitem> - - <listitem> - <para>The target document is only a view on the source document. We may - for example extract the chapter names from a <tag - class="starttag">book</tag> document to create a table of - contents.</para> - </listitem> - </itemizedlist> + <figure xml:id="sda1_fig_xsltTargetFormats"> + <title><xref linkend="glo_XSL"/> target formats</title> + + <itemizedlist> + <listitem> + <para><link xlink:href="http://unicode.org">Unicode</link> encoded + ordinary text.</para> + </listitem> + + <listitem> + <para>XML.</para> + </listitem> + + <listitem> + <para>HTML</para> + </listitem> + + <listitem> + <para>XHTML</para> + </listitem> + </itemizedlist> + </figure> + + <figure xml:id="sda1_fig_xsltMotivation"> + <title>Motivating <xref linkend="glo_XSL"/></title> + + <itemizedlist> + <listitem> + <para>The target document expresses similar semantics but uses a + different XML dialect <abbrev>i.e.</abbrev> different tag + names.</para> + </listitem> + + <listitem> + <para>The target document is only a view on the source + document.</para> + + <para>Example: Extract a <tag class="starttag">book</tag>'s chapter + titles creating a table of contents.</para> + </listitem> + </itemizedlist> + </figure> <section xml:id="sda1SectXslPreconditions"> <title>Required knowledge</title> @@ -155,12 +158,10 @@ </memo></programlisting> </figure> - <para>We want to extract the sender's name from an arbitrary <tag - class="element">memo</tag> document instance. Using <abbrev - xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> this task can be - accomplished by a script <filename>memo2sender.xsl</filename>:</para> + <figure xml:id="sda1_fig_xsltExtractSender"> + <title>Extracting the sender's name</title> - <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> + <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> @@ -171,23 +172,26 @@ </xsl:template> </xsl:stylesheet></programlisting> + </figure> - <para>Before closer examining this code we first show its effect. We need - a piece of software called a <abbrev - xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> processor. It reads - both a <tag>memo</tag> document instance and a style sheet and produces - the following output:</para> + <figure xml:id="sda1_fig_xsltExtractSenter"> + <title>Execution and Result</title> - <screen><computeroutput>[goik@mupter Memoref]$ xml2xml message.xml memo2sender.xsl + <para><acronym>Cli</acronym> XSLT processor execution:</para> + + <screen><computeroutput>[goik@mupter Memoref]$ xml2xml message.xml memo2sender.xsl Martin Goik</computeroutput></screen> - <para>The result is the sender's name <computeroutput>Martin - Goik</computeroutput>. We may sketch the transformation principle:</para> + <para>The result is the sender's name <computeroutput>Martin + Goik</computeroutput>. We may sketch the transformation + principle:</para> + </figure> + + <para>We sketch the transformation principle:</para> <figure xml:id="figure_xsl_principle"> - <title>An <abbrev xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> - processor transforming a XML document into a result using a - stylesheet</title> + <title><abbrev xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> + processor transforming XML using a stylesheet</title> <mediaobject> <imageobject> @@ -206,21 +210,25 @@ Martin Goik</computeroutput></screen> examine the <abbrev xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> example code:</para> - <programlisting language="xml"><xsl:stylesheet <co - xml:id="programlisting_helloxsl_stylesheet"/> xmlns:xsl <co - xml:id="programlisting_helloxsl_namespace_abbv"/> ="http://www.w3.org/1999/XSL/Transform" + <figure xml:id="sda1_fig_xsltExtractSenderDetails"> + <title>Transformation syntax details</title> + + <programlisting language="xml"><xsl:stylesheet <co + xml:id="programlisting_helloxsl_stylesheet"/> xmlns:xsl <co + xml:id="programlisting_helloxsl_namespace_abbv"/> ="http://www.w3.org/1999/XSL/Transform" version="2.0" <co xml:id="programlisting_helloxsl_xsl_version"/> > <xsl:output method="text" <co - xml:id="programlisting_helloxsl_method_text"/>/> + xml:id="programlisting_helloxsl_method_text"/>/> <xsl:template <co xml:id="programlisting_helloxsl_template"/> match <co - xml:id="programlisting_helloxsl_match"/> ="/memo"> + xml:id="programlisting_helloxsl_match"/> ="/memo"> <xsl:value-of <co xml:id="programlisting_helloxsl_value-of"/> select <co - xml:base="" xml:id="programlisting_helloxsl_valueof_select_att"/> ="from" /> + xml:base="" xml:id="programlisting_helloxsl_valueof_select_att"/> ="from" /> </xsl:template> </xsl:stylesheet></programlisting> + </figure> <calloutlist> <callout arearefs="programlisting_helloxsl_stylesheet"> @@ -251,17 +259,17 @@ Martin Goik</computeroutput></screen> </callout> <callout arearefs="programlisting_helloxsl_xsl_version"> - <para>The <link xlink:href="https://www.w3.org/TR/xslt20">XSL - standard</link> is still evolving. The version number identifies the - conformance level for the subsequent code.</para> + <para><link xlink:href="https://www.w3.org/TR/xslt20">XSL</link> is an + evolving standard: The version number identifies subsequent code's + conformance level.</para> </callout> <callout arearefs="programlisting_helloxsl_method_text"> <para>The <tag class="attribute">method</tag> attribute in the <link xlink:href="https://www.w3.org/TR/xslt20/#element-output"><xsl:output></link> - element specifies the type of output to be generated. Depending on - this type we may also define indentation depths and/or encoding. - Allowed <tag class="attvalue">method</tag> values are:</para> + element specifies the type of output to be generated. It allows for + defining indentation depths and/or encoding. Allowed <tag + class="attvalue">method</tag> values are:</para> <glosslist> <glossentry> @@ -316,8 +324,8 @@ Martin Goik</computeroutput></screen> class="starttag">xsl:template</tag> is appropriate. In the given example the value <code>/memo</code> tells us that the template is only responsible for <tag class="element">memo</tag> nodes appearing - at top level i.e. being the root element of the document - instance.</para> + at top level <abbrev>i.e.</abbrev> being the root element of the + document instance.</para> </callout> <callout arch="" @@ -338,12 +346,74 @@ Martin Goik</computeroutput></screen> <para>The <acronym xlink:href="https://www.w3.org/TR/xpath">XPath</acronym> standard allows us to retrieve node sets from XML documents by predicate based queries. - Thus its role may be compared to <acronym - xlink:href="https://en.wikipedia.org/wiki/Sql">SQL</acronym> + Thus its role may be compared to <xref linkend="glo_SQL"/> <code>SELECT</code> ... <code>FROM</code> ...<code>WHERE</code> queries. Some simple examples:</para> - <figure xml:id="fig_Xpath"> + <figure xml:id="sda1_fig_sqlXpathCompare"> + <title>Comparing <xref linkend="glo_SQL"/> and <xref + linkend="glo_XPath"/></title> + + <para>Predicate based queries:</para> + + <informaltable border="1"> + <tr> + <td valign="top"><programlisting>SELECT name, email +from Customer +WHERE dept='finance' + or category = 12</programlisting></td> + + <td valign="top"><programlisting><database> + ... + <customer dept='finance'>... + +</database></programlisting><programlisting>/database//customer[@dept='finance' + or category='7']</programlisting></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_fig_sqlXpathCommonDifferent"> + <title>Similarities and differences</title> + + <para>Predicate base queries:</para> + + <informaltable border="1"> + <tr> + <th><xref linkend="glo_SQL"/></th> + + <th><xref linkend="glo_XPath"/></th> + </tr> + + <tr> + <td align="center" colspan="2" valign="top"><itemizedlist> + <listitem> + <para>Predicate based queries using boolean algebra</para> + </listitem> + </itemizedlist></td> + </tr> + + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para>Joins</para> + </listitem> + + <listitem> + <para><quote>Flat</quote> data</para> + </listitem> + </itemizedlist></td> + + <td valign="top"><itemizedlist> + <listitem> + <para>Hierarchical data support</para> + </listitem> + </itemizedlist></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="fig_XpathExamples"> <title>Simple <acronym xlink:href="https://www.w3.org/TR/xpath">XPath</acronym> queries</title> @@ -354,31 +424,154 @@ Martin Goik</computeroutput></screen> </mediaobject> </figure> + <figure xml:id="fig_XpathContextNodeEx1"> + <title><xref linkend="glo_XPath"/> and context nodes 1</title> + + <informaltable border="1"> + <tr> + <td valign="top"><glosslist> + <glossentry> + <glossterm>Context node</glossterm> + + <glossdef> + <para><tag class="starttag">top</tag></para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>XPath</glossterm> + + <glossdef> + <para><code>b/a</code></para> + </glossdef> + </glossentry> + </glosslist></td> + + <td valign="top"><programlisting language="xml"><top> + <b> +<emphasis role="red"> <a>One</a></emphasis> <emphasis + role="red"> + <a>Two</a></emphasis> +<emphasis role="red"> <a>Three</a></emphasis> +<emphasis role="red"> <a>Four</a></emphasis> + </b> + <c>Mixed<a>content></a>Example</c> +</top></programlisting></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="fig_XpathContextNodeEx2"> + <title><xref linkend="glo_XPath"/> and context nodes 2</title> + + <informaltable border="1"> + <tr> + <td valign="top"><glosslist> + <glossentry> + <glossterm>Context node</glossterm> + + <glossdef> + <para><tag class="starttag">top</tag></para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>XPath</glossterm> + + <glossdef> + <para><code>(b|c)/a</code></para> + </glossdef> + </glossentry> + </glosslist></td> + + <td valign="top"><programlisting language="xml"><top> + <b> +<emphasis role="red"> <a>One</a></emphasis> <emphasis + role="red"> + <a>Two</a></emphasis> +<emphasis role="red"> <a>Three</a></emphasis> +<emphasis role="red"> <a>Four</a></emphasis> + </b> + <c>Mixed<emphasis role="red"><a>content></a></emphasis>Example</c> +</top></programlisting></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="fig_XpathContextNodeEx3"> + <title><xref linkend="glo_XPath"/> and context nodes 2</title> + + <informaltable border="1"> + <tr> + <td valign="top"><glosslist> + <glossentry> + <glossterm>Context node</glossterm> + + <glossdef> + <para><tag class="starttag">top</tag></para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>XPath</glossterm> + + <glossdef> + <para><code>(b|c)/a</code></para> + </glossdef> + </glossentry> + </glosslist></td> + + <td valign="top"><programlisting language="xml"><top> + <b> +<emphasis role="red"> <a>One</a></emphasis> <emphasis + role="red"> + <a>Two</a></emphasis> +<emphasis role="red"> <a>Three</a></emphasis> +<emphasis role="red"> <a>Four</a></emphasis> + </b> + <c>Mixed<emphasis role="red"><a>content></a></emphasis>Example</c> +</top></programlisting></td> + </tr> + </informaltable> + </figure> + + <figure xml:id="sda1_fig_xpathConstructs"> + <title>Important constructs</title> + + <glosslist> + <glossentry> + <glossterm>a/b/c</glossterm> + + <glossdef> + <para/> + </glossdef> + </glossentry> + </glosslist> + </figure> + </section> + + <section xml:id="sda1_sect_memoRecipents"> + <title>Example: <tag class="element">memo</tag> recipients</title> + <para>We are now interested in a list of all recipients being defined in a <tag class="element">memo</tag> element. We introduce the element <tag class="element">xsl:for-each</tag> which iterates over a result set of nodes:</para> <figure xml:id="programlisting_tolist_xpath"> - <title>Iterating over the list of recipient nodes.</title> + <title>List of recipient nodes iteration.</title> - <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> - -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="2.0"> - - <xsl:output method="text"/> - - <xsl:template match="/" <co xml:id="programlisting_tolist_match_root"/>> - <xsl:for-each select="memo/to" <co + <programlisting language="xml"><xsl:template match="/" <co + xml:id="programlisting_tolist_match_root"/>> + <xsl:for-each select="memo/to" <co xml:id="programlisting_tolist_xpath_memo_to"/> > - <xsl:value-of select="." <co xml:id="programlisting_tolist_value_of"/> /> - <xsl:text>,</xsl:text> <co + <xsl:value-of select="." <co xml:id="programlisting_tolist_value_of"/> /> + <xsl:text>,</xsl:text> <co xml:id="programlisting_tolist_xsl_text"/> - </xsl:for-each> - </xsl:template> - -</xsl:stylesheet></programlisting> + </xsl:for-each> +</xsl:template></programlisting> + + <screen>Adam Hacker,Eve Intruder,</screen> </figure> <calloutlist> @@ -408,18 +601,8 @@ Martin Goik</computeroutput></screen> </callout> </calloutlist> - <figure xml:id="figure_recipientlist_trailing_comma"> - <title>A list of recipients.</title> - - <para>The <abbrev xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> - presented before yields:</para> - - <screen><computeroutput>Adam Hacker,Eve Intruder</computeroutput><emphasis - role="bold">,</emphasis></screen> - </figure> - - <para>Right now we do not bother about the trailing <quote>,</quote> after - the last recipient. The surrounding + <para>Right now we do not bother about the trailing <quote>,</quote> + following the last recipient. The surrounding <code><xsl:text></code>,<code></xsl:text></code> elements <emphasis>may</emphasis> be omitted. We encourage the reader to leave them in place since they increase readability when a template's body gets more @@ -516,14 +699,13 @@ Martin Goik</computeroutput></screen> </glossentry> </glosslist> - <para>In order to explain relative <abbrev - xlink:href="https://www.w3.org/TR/xpath">XPath</abbrev> expressions we - consider <code>content/para</code> starting from the (unique!) <tag + <para>In order to explain relative <xref linkend="glo_XPath"/> expressions + we consider <code>content/para</code> starting from the (unique!) <tag class="element">memo</tag> node:</para> <figure xml:id="memoXpathPara"> - <title>The node set represented by <code>content/para</code> starting at - the context node <tag class="starttag">memo</tag>.</title> + <title><xref linkend="glo_XPath"/> <code>content/para</code> starting + from context node <tag class="starttag">memo</tag>.</title> <mediaobject> <imageobject> @@ -2344,8 +2526,8 @@ Jack Eve Jude <----Tolstoi----> <co generic <link xlink:href="https://en.wikipedia.org/wiki/Tree_traversal#Depth-first_search">depth-first traversal</link> of arbitrary <xref linkend="glo_XML"/> - input documents.</parameter> - <programlisting language="xsl"><xsl:template match="/ | @* | node()"> + input documents.</parameter> <programlisting + language="xsl"><xsl:template match="/ | @* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> diff --git a/Tests/Common/vorbereitung.xml b/Tests/Common/vorbereitung.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc65188ffc38933cfddebf6f70a1d179b4048236 --- /dev/null +++ b/Tests/Common/vorbereitung.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<section version="5.1" xml:id="Vorbereitung" xml:lang="de" + xmlns="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:trans="http://docbook.org/ns/transclusion" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:m="http://www.w3.org/1998/Math/MathML" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:db="http://docbook.org/ns/docbook"> + <title>Vorbereitung</title> + + <orderedlist> + <listitem> + <para>Starten Sie den Webbrowser Ihrer Wahl: Zur Verfügung stehen + Firefox und Chrome.</para> + </listitem> + + <listitem> + <para>Starten Sie die IntelliJ Idea Entwicklungsumgebung. Unter <uri + xlink:href="https://freedocs.mi.hdm-stuttgart.de/sd1_sect_ideaMavenImport.html">https://freedocs.mi.hdm-stuttgart.de/sd1_sect_ideaMavenImport.html</uri> + finden Sie eine Anleitung zum Umgang mit Projekten während einer + Prüfung.</para> + </listitem> + + <listitem> + <para>Öffnen Sie benötigte Links:</para> + + <informaltable border="0"> + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para><link + xlink:href="https://freedocs.mi.hdm-stuttgart.de/sd1.html">Lecture + notes »Software development 1«</link></para> + + <para>Achtung: Manche Links, etwa auf die Gitlab + Musterlösungen, funktionieren nicht. Es gibt ein <link + xlink:href="https://freedocs.mi.hdm-stuttgart.de/extra/sd1.zip">Archiv + der Musterlösungen</link>.</para> + </listitem> + + <listitem> + <para><link + xlink:href="http://docs.oracle.com/javase/8/docs/api">Java™ + Platform API Specification</link></para> + </listitem> + + <listitem> + <para><link xlink:href="http://junit.org/javadoc/latest">JUnit + API</link></para> + </listitem> + </itemizedlist></td> + + <td valign="top"><itemizedlist> + <listitem> + <para><link + xlink:href="https://klausur.mi.hdm-stuttgart.de/ilias/goto.php?target=wiki_88&client_id=iliasclient1">»Spickzettel«</link> + (außerhalb der redaktionellen Verantwortung des + Dozenten).</para> + </listitem> + + <listitem> + <para><link + xlink:href="https://klausur.mi.hdm-stuttgart.de/ilias/goto.php?target=file_415&client_id=iliasclient1">Budi + Kurniawans »Java: A Beginner’s Tutorial« .</link></para> + </listitem> + + <listitem> + <para><link + xlink:href="http://openbook.rheinwerk-verlag.de/javainsel">Lehrbuch + »Java ist auch eine Insel«</link></para> + </listitem> + + <listitem> + <para><link xlink:href="https://www.leo.org">Online Wörterbuch + »Leo«</link></para> + </listitem> + + <listitem> + <para><link xlink:href="https://www.dict.cc">Online Wörterbuch + »dict.cc«</link></para> + </listitem> + </itemizedlist></td> + </tr> + </informaltable> + </listitem> + + <listitem> + <para>Wichtige Hinweise:</para> + + <itemizedlist> + <listitem> + <para>Laden Sie Musterlösungen bzw. Projektarchive rechtzeitig in + das Klausursystem hoch. Sie können dies mehrfach tun, es wird + lediglich die zuletzt hochgeladene Version gewertet.</para> + + <para>Beachten Sie dazu die oben erwähnte Anleitung.</para> + </listitem> + + <listitem> + <para>Nutzen Sie die reguläre Abgabe des ILIAS Systems zur Prüfung + der Vollständigkeit Ihrer Lösungen.</para> + </listitem> + </itemizedlist> + </listitem> + </orderedlist> +</section> diff --git a/ws/Docbook/CustomLayer/Klausur/docbook2klausur.xsl b/ws/Docbook/CustomLayer/Klausur/docbook2klausur.xsl index 1d0e50beecf6dc9198f20cd98c58020598e98a24..12a5801006bf768f783233891117ed7fc87634df 100644 --- a/ws/Docbook/CustomLayer/Klausur/docbook2klausur.xsl +++ b/ws/Docbook/CustomLayer/Klausur/docbook2klausur.xsl @@ -10,9 +10,10 @@ xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" - exclude-result-prefixes="xs" + exclude-result-prefixes="xs xlink xila xi trans db svg html m" version="2.0"> + <xsl:template match="/db:book"> <xsl:apply-templates select="db:chapter"/> </xsl:template> @@ -106,7 +107,25 @@ </span> </xsl:template> - <xsl:template match="db:link"> + + <xsl:template match="db:informaltable"> + <table border="0"> + <xsl:for-each select="db:tr"> + <tr> + <xsl:for-each select="db:td"> + <td valign="top"> + <xsl:apply-templates select="text()|*"/> + </td> + + </xsl:for-each> + </tr> + </xsl:for-each> + + </table> + + </xsl:template> + + <xsl:template match="db:link|db:uri"> <!-- link already present from template mode='link' --> <xsl:apply-templates/> </xsl:template> @@ -169,7 +188,7 @@ <!-- link mode --> - <xsl:template mode="link" match="db:package|db:classname|db:interfacename|db:methodname|db:link|db:emphasis|db:code|db:filename|db:foreignphrase|db:productname"> + <xsl:template mode="link" match="db:package|db:classname|db:interfacename|db:methodname|db:link|db:uri|db:emphasis|db:code|db:filename|db:foreignphrase|db:productname"> <xsl:choose> <xsl:when test="@xlink:href"> <a href="{@xlink:href}" target="_blank">