1<!--
2   Filename:     FWObjectDatabase_2.1.0.xslt
3   Author:       Tidei Maurizio     <fwbuilder-routing at compal.de>
4   Build date:   09/27/2005
5   Last changed: 09/27/2005
6   Version:      1.0.0
7   Description:  translates fwbuilder object database from v2.1.0 to v2.1.1
8
9                 changes version number
10                 adds Routing element if necessary
11-->
12
13
14<xsl:stylesheet version="1.0"
15    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16    xmlns:fwb="http://www.fwbuilder.org/1.0/"
17    exclude-result-prefixes="fwb">
18
19
20 <xsl:output method="xml" version="1.0"
21    doctype-system="fwbuilder.dtd" indent="yes" encoding="utf-8"/>
22
23<xsl:template match="*" mode="copy">
24  <xsl:copy>
25    <xsl:copy-of select="@*"/>
26    <xsl:apply-templates mode="copy"/>
27  </xsl:copy>
28</xsl:template>
29
30<xsl:template match="fwb:Firewall" mode="copy">
31
32  <xsl:variable name="fwid" select="@id"/>
33
34  <Firewall xmlns="http://www.fwbuilder.org/1.0/">
35    <xsl:copy-of select="@*"/>
36      <xsl:text>
37        </xsl:text>
38    <xsl:for-each select="*">
39      <xsl:copy-of select="."/>
40      <xsl:text>
41        </xsl:text>
42      <xsl:if test="local-name()='Policy'">
43        <xsl:choose>
44          <xsl:when test="following::*[local-name()='Routing']">
45          </xsl:when>
46          <xsl:otherwise>
47       <xsl:element name="Routing">
48         <xsl:attribute name="id"><xsl:value-of select="$fwid"/>-routing</xsl:attribute>
49       </xsl:element>
50       <xsl:text>
51        </xsl:text>
52          </xsl:otherwise>
53        </xsl:choose>
54      </xsl:if>
55    </xsl:for-each>
56  </Firewall>
57</xsl:template>
58
59<xsl:template match="*[attribute::id='root']">
60  <FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/">
61  <xsl:attribute name="version">2.1.1</xsl:attribute>
62  <xsl:attribute name="id">root</xsl:attribute>
63  <xsl:apply-templates select="*" mode="copy"/>
64  </FWObjectDatabase>
65</xsl:template>
66
67</xsl:stylesheet>
68