Skip to content

Instantly share code, notes, and snippets.

@raul1991
Created June 25, 2014 13:03
Show Gist options
  • Save raul1991/c83973609a518785c073 to your computer and use it in GitHub Desktop.
Save raul1991/c83973609a518785c073 to your computer and use it in GitHub Desktop.
Xslt file
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output method="xml" indent="yes" xalan:indent-amount="2" omit-xml-declaration="no"/>
<xsl:template match="FlatRateSMSConfiguration">
<FlatRateSMSConfiguration>
<xsl:attribute name="xsi:noNamespaceSchemaLocation"><xsl:value-of select="@xsi:noNamespaceSchemaLocation"/></xsl:attribute>
<xsl:for-each select="Configuration">
<xsl:element name="Configuration">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:copy-of select="SMSServiceDays"/>
<xsl:copy-of select="SMSServiceCharge"/>
<xsl:copy-of select="MinimumBalance"/>
<xsl:copy-of select="ServiceClassMap"/>
<xsl:copy-of select="NoInputTimeout"/>
<xsl:copy-of select="MaxTimeoutRetries"/>
<xsl:copy-of select="MaxInvalidRetries"/>
<xsl:copy-of select="MainMenuDTMF"/>
<xsl:copy-of select="ConfirmDTMF"/>
<xsl:copy-of select="NegateDTMF"/>
<xsl:choose>
<xsl:when test="MnpDaId">
<xsl:copy-of select="MnpDaId"/>
</xsl:when>
<xsl:otherwise>
<MnpDaId>1</MnpDaId>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="LtdDaId">
<xsl:copy-of select="LtdDaId"/>
</xsl:when>
<xsl:otherwise>
<LtdDaId>2</LtdDaId>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="FlatRateDataServiceConfiguration">
<xsl:element name="FlatRateDataServiceConfiguration">
<xsl:element name="ServiceSpecificData">
<xsl:for-each select="FlatRateDataServiceConfiguration/ServiceSpecificData/ServiceClassData">
<xsl:element name="ServiceClassData">
<xsl:attribute name="dtmf"><xsl:value-of select="@dtmf"/></xsl:attribute>
<xsl:attribute name="minimumBalance"><xsl:value-of select="@minimumBalance"/></xsl:attribute>
<xsl:attribute name="promptId"><xsl:value-of select="@promptId"/></xsl:attribute>
<xsl:attribute name="refillProfileId"><xsl:value-of select="@refillProfileId"/></xsl:attribute>
<xsl:attribute name="serviceClass"><xsl:value-of select="@serviceClass"/></xsl:attribute>
<xsl:attribute name="serviceDays"><xsl:value-of select="@serviceDays"/></xsl:attribute>
<xsl:attribute name="transactionAmount"><xsl:value-of select="@transactionAmount"/></xsl:attribute>
<xsl:attribute name="transactionCurrency"><xsl:value-of select="@transactionCurrency"/></xsl:attribute>
<xsl:choose>
<xsl:when test="@planType">
<xsl:attribute name="planType"><xsl:value-of select="@planType"/></xsl:attribute>
<xsl:attribute name="pamServiceId"><xsl:value-of select="@pamServiceId"/></xsl:attribute>
<xsl:attribute name="offerId"><xsl:value-of select="@offerId"/></xsl:attribute>
<xsl:attribute name="terminationPromptId"><xsl:value-of select="@terminationPromptId"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="planType">NORMAL</xsl:attribute>
<xsl:attribute name="pamServiceId">1</xsl:attribute>
<xsl:attribute name="offerId">1</xsl:attribute>
<xsl:attribute name="terminationPromptId">USER_FRDS_FINAL_MSG</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:choose>
<xsl:when test="./FlatRateDataServiceConfiguration">
<xsl:copy-of select="UserType"/>
</xsl:when>
<xsl:otherwise>
<UserType>SmartPhone Users</UserType>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<FlatRateDataServiceConfiguration>
<ServiceSpecificData>
<ServiceClassData planType="NORMAL" dtmf="2" minimumBalance="80" promptId="USER_FRDS_SEVEN_DAYS_MSG" refillProfileId="E1" serviceClass="10" serviceDays="7" transactionAmount="26" transactionCurrency="EUR" pamServiceId="1" offerId="1" terminationPromptId="FRDS_MORE_DAYS"/>
</ServiceSpecificData>
<UserType>2G</UserType>
</FlatRateDataServiceConfiguration>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:for-each>
</FlatRateSMSConfiguration>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment