xmlxsltmulesoftibm-datapower

Can anyone please explain what is happening in this XSLT code?


I am working in a project (datapower to mule migration) I am beginner in XSLT and have no experience. Can anyone please help me to understand the working of this xslt file so that I can migrate it into mule API. This is my XSLT file :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:dp="http://www.datapower.com/extensions"
     xmlns:fin="http://schemas.zurich.com/zsoa/fig/policymanagement/2009/01/financialservicesagreement"
     xmlns:par="http://schemas.zurich.com/zsoa/fig/policymanagement/2009/01/party"
     xmlns:pol="http://webservices.zurich.com/zsoa/fig/policymanagement/policyinquiry-v4_0"
     exclude-result-prefixes="dp" version="1.0">

    <xsl:output method="xml" indent="yes" />
    <xsl:variable name="plcynum" select="dp:variable('var://context/PIPE/pc')" />

    <dp:set-variable name="'var://context/PIPE/LP'" value="'LEARNER'S PERMIT'" />

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>

    <!--<xsl:template match="ntig[descendant::term[. = '']]"/>-->
    <!-- <xsl:template match="langSet[not(descendant::term[. != ''])]"/>-->

    <xsl:template match="fin:basicPolicy[
                           descendant::fin:policyNumber[
                             normalize-space(.) 
                             != dp:variable('var://context/PIPE/pc')
                           ]
                         ]"/>

    <!--xsl:template match="pol:houseHoldMembers[not(descendant::par:primeRole[ normalize-space(.) !='CLIENT IS A DRIVER' or  normalize-space(.) !='EXCLUDED DRIVER' or  normalize-space(.) != dp:variable('var://context/PIPE/LP')])]"></xsl:template-->
</xsl:stylesheet>

Solution

  • It's a stylesheet with two template rules. The first rule says the default action is to copy everything from the input unchanged. The second rule (because it's empty) says that when elements matching a particular pattern are encountered, they should be dropped. Specifically, a basicPolicy element should be dropped if contains a policyNumber that meets particular criteria; I don't understand the criteria because they are defined using a non-standard Datapower extension.