blob: e627cf089ddd60c845e9b4a73c4fa8d0288d47df [file] [log] [blame]
<!--
Connection Manager
Copyright (C) 2011 The Chromium OS Authors. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
<!--
Generate an easy-to-parse table of APN's from
the mobile providers database
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="country"/>
<xsl:template match="provider">
<xsl:if test="count(gsm[*])!=0">
provider:<xsl:value-of select="count(name)"/>,<xsl:value-of select="count(gsm/apn)"/>,<xsl:choose>
<xsl:when test="@primary='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise>
</xsl:choose>,<xsl:choose>
<xsl:when test="@roaming-required='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="name"/><xsl:apply-templates select="gsm"/>
</xsl:if>
</xsl:template>
<xsl:template match="name">
name:<xsl:value-of select="@xml:lang"/>,<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="gsm">
networks:<xsl:apply-templates select="network-id"/>
<xsl:apply-templates select="apn"/></xsl:template>
<xsl:template match="network-id"><xsl:value-of select="@mcc"/><xsl:value-of select="@mnc"/><xsl:if test="position()!=last()">,</xsl:if></xsl:template>
<xsl:template match="apn">
apn:<xsl:value-of select="count(name)"/>,<xsl:value-of select="@value"/>,<xsl:value-of select="username"/>,<xsl:value-of select="password"/>
<xsl:apply-templates select="name"/>
</xsl:template>
<xsl:output method="text" indent="no" encoding="utf-8"
omit-xml-declaration="yes"/>
<xsl:template match="/serviceproviders"># Generated file -- Do not edit
#
# This file starts with the line
#
# serviceproviders:<xsl:value-of select="@format"/>
#
# The rest of the file is divided into country blocks, each of which
# is of the form
#
# country:xx
# &lt;provider block 1&gt;
# &lt;provider block 2&gt;
# . . .
# &lt;provider block N&gt;
#
# where xx is the two character ISO country code.
#
# Each provider block is of the form
#
# provider:&lt;# of names&gt;,&lt;# of APNs&gt;,&lt;primary&gt;
# name:&lt;lang&gt;,&lt;name 1&gt;
# name:&lt;lang&gt;,&lt;name 2&gt;
# . . .
# networks:NNNNNN,NNNNNN,...
# apn:&lt;# of descriptive names&gt;,&lt;value&gt;,&lt;username&gt;,&lt;password&gt;
# name:&lt;lang&gt;,&lt;desciptive name 1&gt;
# name:&lt;lang&gt;,&lt;desciptive name 2&gt;
# . . .
# apn:&lt;# of descriptive names&gt;,&lt;value&gt;,&lt;username&gt;,&lt;password&gt;
# . . .
#
# where each NNNNNN is the five or six digit string constructed by
# concatenating the three-digit MCC (Mobile Country Code) and two-
# or three-digit MNC (Mobile Network Code), and where the &lt;username&gt;
# and &lt;password&gt; fields may be empty. Each 'name' entry for both
# providers and APNs, has an optional language attribute that can
# be used to choose a localized name to display to the user, based
# on the current locale. The language tags are in the format defined
# by RFC 5646.
#
serviceproviders:<xsl:value-of select="@format"/>
<xsl:text>
</xsl:text>
<xsl:for-each select="./country">country:<xsl:value-of select="@code"/>
<xsl:apply-templates/><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<!-- vim:set sw=2 sts=2 et: -->