Lösungen zu Übung 3 — xsl:mode on-no-match="shallow-skip"
Im Folgenden finden Sie die Lösungsdateien zu Übung 3 unter xsl:mode on-no-match="shallow-skip".
Code-Beispiel: Lösungs-XSLT zu Übung 3.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math" version="3.0">
<xsl:mode streamable="yes" on-no-match="shallow-skip"/>
<xsl:output indent="yes"/>
<xsl:template match="year">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="month">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="temperature">
<xsl:copy>
<xsl:copy-of select="@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Code-Beispiel: Vollständiges Output-XML zu Übung 3.
<?xml version="1.0" encoding="UTF-8"?>
<year value="2015">
<month name="january">
<temperature min="-2,1" max="3,2" unit="celsius"/>
</month>
<month name="february">
<temperature min="-1,2" max="5,1" unit="celsius"/>
</month>
<month name="march">
<temperature min="1,5" max="9,2" unit="celsius"/>
</month>
<month name="april">
<temperature min="4,5" max="13,5" unit="celsius"/>
</month>
<month name="may">
<temperature min="8,5" max="18" unit="celsius"/>
</month>
<month name="june">
<temperature min="11,7" max="21" unit="celsius"/>
</month>
<month name="july">
<temperature min="13,5" max="23,3" unit="celsius"/>
</month>
<month name="august">
<temperature min="13,3" max="23" unit="celsius"/>
</month>
<month name="september">
<temperature min="10,4" max="19,8" unit="celsius"/>
</month>
<month name="october">
<temperature min="6,4" max="14,5" unit="celsius"/>
</month>
<month name="november">
<temperature min="1,9" max="8" unit="celsius"/>
</month>
<month name="december">
<temperature min="-1" max="4,1" unit="celsius"/>
</month>
</year>
Tipp der data2type-Redaktion: Zum Thema XSLT bieten wir auch folgende Schulungen zur Vertiefung und professionellen Fortbildung an: |