comparison flys-aft/doc/repair.xsl @ 4083:44dc38ca8492

Added an optional XSL transformation to fix the raw DIPS files. flys-aft/trunk@3513 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 21 Dec 2011 14:56:29 +0000
parents
children
comparison
equal deleted inserted replaced
4082:d13011e53022 4083:44dc38ca8492
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
4 <xsl:output method="xml"/>
5
6 <xsl:key name="gauge-name" match="/STATIONEN/STATION" use="@NAME"/>
7
8 <xsl:template name="lookup-gauge-number">
9 <xsl:param name="name"/>
10 <xsl:param name="number"/>
11 <xsl:variable name="fixed-number">
12 <xsl:for-each select="document('pegelstationen.xml')">
13 <xsl:value-of select="key('gauge-name', $name)/@NUMMER"/>
14 </xsl:for-each>
15 </xsl:variable>
16 <xsl:choose>
17 <xsl:when test="$fixed-number != ''">
18 <xsl:value-of select="$fixed-number"/>
19 </xsl:when>
20 <xsl:otherwise>
21 <xsl:value-of select="$number"/>
22 </xsl:otherwise>
23 </xsl:choose>
24 </xsl:template>
25
26 <xsl:template match="/DIPSFLYS/STATIONEN/PEGELSTATION">
27 <PEGELSTATION>
28 <xsl:attribute name="NUMMER">
29 <xsl:call-template name="lookup-gauge-number">
30 <xsl:with-param name="name" select="@NAME"/>
31 <xsl:with-param name="number" select="@NUMMER"/>
32 </xsl:call-template>
33 </xsl:attribute>
34 <xsl:apply-templates select="@*[local-name() != 'NUMMER']"/>
35 <xsl:apply-templates select="node()"/>
36 </PEGELSTATION>
37 </xsl:template>
38
39 <xsl:template match="@*|node()">
40 <xsl:copy>
41 <xsl:apply-templates select="@*|node()"/>
42 </xsl:copy>
43 </xsl:template>
44
45 </xsl:stylesheet>

http://dive4elements.wald.intevation.org