ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/VPN/mpd.xsl
Revision: 860
Committed: 2006-08-08T17:33:13-07:00 (18 years, 10 months ago) by douglas
Content type: text/xml
File size: 2876 byte(s)
Log Message:
Odd!

File Contents

# Content
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 MPD Intermediate
4
5 Douglas Thrift
6
7 $Id$
8 -->
9 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:admin="http://svn.douglasthrift.net/svn/repos/FreeBSDAdmin" exclude-result-prefixes="xsl xs admin">
10 <xsl:output method="xml" indent="yes"/>
11
12 <xsl:template match="mpd">
13 <mpd>
14 <xsl:for-each select="range">
15 <xsl:variable name="local" as="xs:string" select="local"/>
16 <xsl:variable name="begin" as="xs:integer*" select="admin:ip(begin)"/>
17 <xsl:variable name="end" as="xs:integer*" select="admin:ip(end)"/>
18 <xsl:variable name="width" as="xs:integer" select="width"/>
19 <xsl:variable name="dns" as="xs:string*" select="dns"/>
20 <xsl:for-each select="$begin[1] to $end[1]">
21 <xsl:variable name="a" as="xs:integer" select="."/>
22 <xsl:for-each select="$begin[2] to $end[2]">
23 <xsl:variable name="b" as="xs:integer" select="."/>
24 <xsl:for-each select="$begin[3] to $end[3]">
25 <xsl:variable name="c" as="xs:integer" select="."/>
26 <xsl:for-each select="$begin[4] to $end[4]">
27 <xsl:call-template name="pptp">
28 <xsl:with-param name="local" as="xs:string" select="$local"/>
29 <xsl:with-param name="remote" as="xs:string" select="admin:ip($a, $b, $c, .)"/>
30 <xsl:with-param name="width" as="xs:integer" select="$width"/>
31 <xsl:with-param name="dns" as="xs:string*" select="$dns"/>
32 </xsl:call-template>
33 </xsl:for-each>
34 </xsl:for-each>
35 </xsl:for-each>
36 </xsl:for-each>
37 </xsl:for-each>
38 </mpd>
39 </xsl:template>
40
41 <xsl:function name="admin:ip" as="xs:integer*">
42 <xsl:param name="ip" as="xs:string"/>
43 <xsl:analyze-string select="$ip" regex="^([0-9]{{1,3}})\.([0-9]{{1,3}})\.([0-9]{{1,3}})\.([0-9]{{1,3}})$">
44 <xsl:matching-substring>
45 <xsl:value-of select="regex-group(1)"/>
46 <xsl:value-of select="regex-group(2)"/>
47 <xsl:value-of select="regex-group(3)"/>
48 <xsl:value-of select="regex-group(4)"/>
49 </xsl:matching-substring>
50 </xsl:analyze-string>
51 </xsl:function>
52
53 <xsl:function name="admin:ip" as="xs:string">
54 <xsl:param name="a" as="xs:integer"/>
55 <xsl:param name="b" as="xs:integer"/>
56 <xsl:param name="c" as="xs:integer"/>
57 <xsl:param name="d" as="xs:integer"/>
58 <xsl:value-of select="concat($a, '.', $b, '.', $c, '.', $d)"/>
59 </xsl:function>
60
61 <xsl:template name="pptp">
62 <xsl:param name="local" as="xs:string"/>
63 <xsl:param name="remote" as="xs:string"/>
64 <xsl:param name="width" as="xs:integer"/>
65 <xsl:param name="dns" as="xs:string*"/>
66 <pptp>
67 <local><xsl:value-of select="$local"/></local>
68 <remote width="{$width}"><xsl:value-of select="$remote"/></remote>
69 <xsl:for-each select="$dns">
70 <dns><xsl:value-of select="."/></dns>
71 </xsl:for-each>
72 </pptp>
73 </xsl:template>
74 </xsl:stylesheet>

Properties

Name Value
svn:keywords Id