[Dive4elements-commits] [PATCH] AFT/DIPS: Added simple XSL transformation to turn DIPS.xml into HTML too be more readable

Wald Commits scm-commit at wald.intevation.org
Wed Mar 27 12:25:23 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1364383421 -3600
# Node ID 662bcb3bdfd7ee106cf14873a1c66b8c3a6bbf0c
# Parent  303701ab73c616a8953d204d771ef1fd09116de0
AFT/DIPS: Added simple XSL transformation to turn DIPS.xml into HTML too be more readable.

diff -r 303701ab73c6 -r 662bcb3bdfd7 flys-aft/contrib/dips2html.xsl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-aft/contrib/dips2html.xsl	Wed Mar 27 12:23:41 2013 +0100
@@ -0,0 +1,162 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="html">
+  <xsl:output method="html"/>
+  <xsl:template name="out">
+    <xsl:param name="value"/>
+    <xsl:choose>
+      <xsl:when test="$value = ''">-/-</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$value"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="PEGELSTATION">
+    <tr>
+      <td>
+        <xsl:value-of select="@NAME"/>
+      </td>
+      <td>
+        <xsl:value-of select="@NUMMER"/>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@HOCHWERT"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@TK_BLATT"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@BETREIBER"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@GEOBREITE"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@GEOLAENGE"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@GEWAESSER"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@GUELTIGAB"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@LAGESTATUS"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@RECHTSWERT"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@ABLESUNGBIS"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@ABLESUNGSEIT"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@STATIONIERUNG"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@EINGERICHTETAM"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@EINZUGSGEBIET_AEO"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@GEBIETSKENNZIFFER"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@KILOMETRIERUNG_AB"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@LAGE_AM_GEWAESSER"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@ENTFERNUNGMUENDUNG"/>
+        </xsl:call-template>
+      </td>
+      <td>
+        <xsl:call-template name="out">
+          <xsl:with-param name="value" select="@KILOMETRIERUNGSRICHTUNG"/>
+        </xsl:call-template>
+      </td>
+    </tr>
+    <xsl:if test="string-length(@BESCHREIBUNG) > 0">
+      <tr>
+        <td/>
+        <td colspan="21">
+          <xsl:value-of select="@BESCHREIBUNG"/>
+        </td>
+      </tr>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template match="/">
+    <html>
+      <head>
+        <title>DiPs</title>
+      </head>
+      <body>
+        <table border="1" cellspacing="0" width="50%">
+          <tr>
+            <th>Name</th>
+            <th>Nummer</th>
+            <th>Hochwert</th>
+            <th>TK-Blatt</th>
+            <th>Betreiber</th>
+            <th>Geo-Breite</th>
+            <th>Geo-L&#xE4;nge</th>
+            <th>Gew&#xE4;sser</th>
+            <th>G&#xFC;ltig ab</th>
+            <th>Lagestatus</th>
+            <th>Rechtswert</th>
+            <th>Ablesung seit</th>
+            <th>Ablesung bis</th>
+            <th>Stationierung</th>
+            <th>Eingerichtet am</th>
+            <th>Einzugsgebiet AEO</th>
+            <th>Gebietskennziffer</th>
+            <th>Kilometrierung ab</th>
+            <th>Lage am Gew&#xE4;sser</th>
+            <th>Entfernung zu M&#xFC;ndung</th>
+            <th>Kilometrierungsrichtung</th>
+          </tr>
+          <xsl:apply-templates select="/DIPSFLYS/STATIONEN"/>
+        </table>
+      </body>
+    </html>
+  </xsl:template>
+  <xsl:template match="text()"/>
+</xsl:stylesheet>


More information about the Dive4elements-commits mailing list