Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 映射/xslt挑战-分组,关键_Xml_Xslt_Map_Biztalk - Fatal编程技术网

Xml 映射/xslt挑战-分组,关键

Xml 映射/xslt挑战-分组,关键,xml,xslt,map,biztalk,Xml,Xslt,Map,Biztalk,我们有一些棘手的映射要求。我正在使用BizTalk mapper在BizTalk应用程序中将传入的xml从一种表单转换为另一种表单。解决方案可以使用XSLT或内置BizTalk functoid完成 源架构如下所示: <?xml version="1.0" encoding="utf-16"?> <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkTestProj

我们有一些棘手的映射要求。我正在使用BizTalk mapper在BizTalk应用程序中将传入的xml从一种表单转换为另一种表单。解决方案可以使用XSLT或内置BizTalk functoid完成

源架构如下所示:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkTestProject.SourceSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://BizTalkTestProject.SourceSchema">
    <xs:element name="Coverages">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Coverage" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Category" type="xs:string"/>
                            <xs:element name="BillingChargeType" type="xs:string"/>
                            <xs:element name="ASLCode" type="xs:string"/>
                            <xs:element name="EffectiveDate" type="xs:string"/>
                            <xs:element name="DeltaAmount" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkTestProject.DestinationSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://BizTalkTestProject.DestinationSchema">
    <xs:element name="Categories" type="CategoriesType"/>
    <xs:complexType name="CategoriesType">
        <xs:sequence>
            <xs:element name="Premium" type="CommonElementsType" maxOccurs="unbounded"/>
            <xs:element name="Tax" type="CommonElementsType" maxOccurs="unbounded"/>
            <xs:element name="Fee" type="CommonElementsType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="CommonElementsType">
        <xs:sequence>
            <xs:element name="CategoryDetail" type="CategoryDetailType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="CategoryDetailType">
        <xs:sequence>
            <xs:element name="Type" type="xs:string"/>
            <xs:element name="AnnualStatementLine" type="xs:string"/>
            <xs:element name="Amount" type="xs:string"/>
            <xs:element name="ChangeEffectiveDate" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
    <ns0:Categories xmlns:ns0="http://BizTalkTestProject.DestinationSchema">
    <Premium>
        <CategoryDetail>
            <Type>premium BillingChargeType 2</Type>
            <AnnualStatementLine>premium ASLCode 2</AnnualStatementLine>
            <Amount>22.00</Amount>
            <ChangeEffectiveDate>2002-02-02</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 1</AnnualStatementLine>
            <Amount>16.00</Amount>
            <ChangeEffectiveDate>2001-01-01</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 2</AnnualStatementLine>
            <Amount>121.11</Amount>
            <ChangeEffectiveDate>2001-01-01</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 1</AnnualStatementLine>
            <Amount>112.22</Amount>
            <ChangeEffectiveDate>2002-02-02</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 3</Type>
            <AnnualStatementLine>premium ASLCode 3</AnnualStatementLine>
            <Amount>33.00</Amount>
            <ChangeEffectiveDate>2003-03-03</ChangeEffectiveDate>
        </CategoryDetail>
    </Premium>
    <Tax>
        <CategoryDetail>
            <Type>tax BillingChargeType 4</Type>
            <AnnualStatementLine>tax ASLCode 4</AnnualStatementLine>
            <Amount>44.00</Amount>
            <ChangeEffectiveDate>2004-04-04</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>tax BillingChargeType 5</Type>
            <AnnualStatementLine>tax ASLCode 5</AnnualStatementLine>
            <Amount>55.00</Amount>
            <ChangeEffectiveDate>2005-05-05</ChangeEffectiveDate>
        </CategoryDetail>
    </Tax>
    <Fee>
        <CategoryDetail>
            <Type>fee BillingChargeType 6</Type>
            <AnnualStatementLine>fee ASLCode 6</AnnualStatementLine>
            <Amount>66.00</Amount>
            <ChangeEffectiveDate>2006-06-06</ChangeEffectiveDate>
        </CategoryDetail>
    </Fee>
</ns0:Categories>

目标架构如下所示:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkTestProject.SourceSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://BizTalkTestProject.SourceSchema">
    <xs:element name="Coverages">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Coverage" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Category" type="xs:string"/>
                            <xs:element name="BillingChargeType" type="xs:string"/>
                            <xs:element name="ASLCode" type="xs:string"/>
                            <xs:element name="EffectiveDate" type="xs:string"/>
                            <xs:element name="DeltaAmount" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkTestProject.DestinationSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://BizTalkTestProject.DestinationSchema">
    <xs:element name="Categories" type="CategoriesType"/>
    <xs:complexType name="CategoriesType">
        <xs:sequence>
            <xs:element name="Premium" type="CommonElementsType" maxOccurs="unbounded"/>
            <xs:element name="Tax" type="CommonElementsType" maxOccurs="unbounded"/>
            <xs:element name="Fee" type="CommonElementsType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="CommonElementsType">
        <xs:sequence>
            <xs:element name="CategoryDetail" type="CategoryDetailType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="CategoryDetailType">
        <xs:sequence>
            <xs:element name="Type" type="xs:string"/>
            <xs:element name="AnnualStatementLine" type="xs:string"/>
            <xs:element name="Amount" type="xs:string"/>
            <xs:element name="ChangeEffectiveDate" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
    <ns0:Categories xmlns:ns0="http://BizTalkTestProject.DestinationSchema">
    <Premium>
        <CategoryDetail>
            <Type>premium BillingChargeType 2</Type>
            <AnnualStatementLine>premium ASLCode 2</AnnualStatementLine>
            <Amount>22.00</Amount>
            <ChangeEffectiveDate>2002-02-02</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 1</AnnualStatementLine>
            <Amount>16.00</Amount>
            <ChangeEffectiveDate>2001-01-01</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 2</AnnualStatementLine>
            <Amount>121.11</Amount>
            <ChangeEffectiveDate>2001-01-01</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 1</AnnualStatementLine>
            <Amount>112.22</Amount>
            <ChangeEffectiveDate>2002-02-02</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 3</Type>
            <AnnualStatementLine>premium ASLCode 3</AnnualStatementLine>
            <Amount>33.00</Amount>
            <ChangeEffectiveDate>2003-03-03</ChangeEffectiveDate>
        </CategoryDetail>
    </Premium>
    <Tax>
        <CategoryDetail>
            <Type>tax BillingChargeType 4</Type>
            <AnnualStatementLine>tax ASLCode 4</AnnualStatementLine>
            <Amount>44.00</Amount>
            <ChangeEffectiveDate>2004-04-04</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>tax BillingChargeType 5</Type>
            <AnnualStatementLine>tax ASLCode 5</AnnualStatementLine>
            <Amount>55.00</Amount>
            <ChangeEffectiveDate>2005-05-05</ChangeEffectiveDate>
        </CategoryDetail>
    </Tax>
    <Fee>
        <CategoryDetail>
            <Type>fee BillingChargeType 6</Type>
            <AnnualStatementLine>fee ASLCode 6</AnnualStatementLine>
            <Amount>66.00</Amount>
            <ChangeEffectiveDate>2006-06-06</ChangeEffectiveDate>
        </CategoryDetail>
    </Fee>
</ns0:Categories>

传入的xml数据示例:

    <ns0:Coverages xmlns:ns0="http://BizTalkTestProject.SourceSchema">
    <Coverage>
        <Category>premium</Category>
        <BillingChargeType>premium BillingChargeType 2</BillingChargeType>
        <ASLCode>premium ASLCode 2</ASLCode>
        <EffectiveDate>2002-02-02</EffectiveDate>
        <DeltaAmount>22.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>premium</Category>
        <BillingChargeType>premium BillingChargeType 1</BillingChargeType>
        <ASLCode>premium ASLCode 1</ASLCode>
        <EffectiveDate>2001-01-01</EffectiveDate>
        <DeltaAmount>11.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>premium</Category>
        <BillingChargeType>premium BillingChargeType 1</BillingChargeType>
        <ASLCode>premium ASLCode 2</ASLCode>
        <EffectiveDate>2001-01-01</EffectiveDate>
        <DeltaAmount>121.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>premium</Category>
        <BillingChargeType>premium BillingChargeType 1</BillingChargeType>
        <ASLCode>premium ASLCode 1</ASLCode>
        <EffectiveDate>2002-02-02</EffectiveDate>
        <DeltaAmount>112.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>premium</Category>
        <BillingChargeType>premium BillingChargeType 3</BillingChargeType>
        <ASLCode>premium ASLCode 3</ASLCode>
        <EffectiveDate>2003-03-03</EffectiveDate>
        <DeltaAmount>33.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>premium</Category>
        <BillingChargeType>premium BillingChargeType 1</BillingChargeType>
        <ASLCode>premium ASLCode 1</ASLCode>
        <EffectiveDate>2001-01-01</EffectiveDate>
        <DeltaAmount>5.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>tax</Category>
        <BillingChargeType>tax BillingChargeType 4</BillingChargeType>
        <ASLCode>tax ASLCode 4</ASLCode>
        <EffectiveDate>2004-04-04</EffectiveDate>
        <DeltaAmount>44.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>tax</Category>
        <BillingChargeType>tax BillingChargeType 5</BillingChargeType>
        <ASLCode>tax ASLCode 5</ASLCode>
        <EffectiveDate>2005-05-05</EffectiveDate>
        <DeltaAmount>55.00</DeltaAmount>
    </Coverage>
    <Coverage>
        <Category>fee</Category>
        <BillingChargeType>fee BillingChargeType 6</BillingChargeType>
        <ASLCode>fee ASLCode 6</ASLCode>
        <EffectiveDate>2006-06-06</EffectiveDate>
        <DeltaAmount>66.00</DeltaAmount>
    </Coverage>
</ns0:Coverages>

溢价
高级计费类型2
高级ASLCode 2
2002-02-02
22
溢价
高级计费类型1
高级ASLCode 1
2001-01-01
11
溢价
高级计费类型1
高级ASLCode 2
2001-01-01
121
溢价
高级计费类型1
高级ASLCode 1
2002-02-02
112
溢价
高级计费类型3
高级ASLCode 3
2003-03-03
33
溢价
高级计费类型1
高级ASLCode 1
2001-01-01
5
税
税单类型4
税务代码4
2004-04-04
44
税
税单收费类型5
税务代码5
2005-05-05
55
费用
收费类型6
费用代码6
2006-06-06
66
预期的输出xml应如下所示:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkTestProject.SourceSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://BizTalkTestProject.SourceSchema">
    <xs:element name="Coverages">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Coverage" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Category" type="xs:string"/>
                            <xs:element name="BillingChargeType" type="xs:string"/>
                            <xs:element name="ASLCode" type="xs:string"/>
                            <xs:element name="EffectiveDate" type="xs:string"/>
                            <xs:element name="DeltaAmount" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkTestProject.DestinationSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://BizTalkTestProject.DestinationSchema">
    <xs:element name="Categories" type="CategoriesType"/>
    <xs:complexType name="CategoriesType">
        <xs:sequence>
            <xs:element name="Premium" type="CommonElementsType" maxOccurs="unbounded"/>
            <xs:element name="Tax" type="CommonElementsType" maxOccurs="unbounded"/>
            <xs:element name="Fee" type="CommonElementsType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="CommonElementsType">
        <xs:sequence>
            <xs:element name="CategoryDetail" type="CategoryDetailType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="CategoryDetailType">
        <xs:sequence>
            <xs:element name="Type" type="xs:string"/>
            <xs:element name="AnnualStatementLine" type="xs:string"/>
            <xs:element name="Amount" type="xs:string"/>
            <xs:element name="ChangeEffectiveDate" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
    <ns0:Categories xmlns:ns0="http://BizTalkTestProject.DestinationSchema">
    <Premium>
        <CategoryDetail>
            <Type>premium BillingChargeType 2</Type>
            <AnnualStatementLine>premium ASLCode 2</AnnualStatementLine>
            <Amount>22.00</Amount>
            <ChangeEffectiveDate>2002-02-02</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 1</AnnualStatementLine>
            <Amount>16.00</Amount>
            <ChangeEffectiveDate>2001-01-01</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 2</AnnualStatementLine>
            <Amount>121.11</Amount>
            <ChangeEffectiveDate>2001-01-01</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 1</Type>
            <AnnualStatementLine>premium ASLCode 1</AnnualStatementLine>
            <Amount>112.22</Amount>
            <ChangeEffectiveDate>2002-02-02</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>premium BillingChargeType 3</Type>
            <AnnualStatementLine>premium ASLCode 3</AnnualStatementLine>
            <Amount>33.00</Amount>
            <ChangeEffectiveDate>2003-03-03</ChangeEffectiveDate>
        </CategoryDetail>
    </Premium>
    <Tax>
        <CategoryDetail>
            <Type>tax BillingChargeType 4</Type>
            <AnnualStatementLine>tax ASLCode 4</AnnualStatementLine>
            <Amount>44.00</Amount>
            <ChangeEffectiveDate>2004-04-04</ChangeEffectiveDate>
        </CategoryDetail>
        <CategoryDetail>
            <Type>tax BillingChargeType 5</Type>
            <AnnualStatementLine>tax ASLCode 5</AnnualStatementLine>
            <Amount>55.00</Amount>
            <ChangeEffectiveDate>2005-05-05</ChangeEffectiveDate>
        </CategoryDetail>
    </Tax>
    <Fee>
        <CategoryDetail>
            <Type>fee BillingChargeType 6</Type>
            <AnnualStatementLine>fee ASLCode 6</AnnualStatementLine>
            <Amount>66.00</Amount>
            <ChangeEffectiveDate>2006-06-06</ChangeEffectiveDate>
        </CategoryDetail>
    </Fee>
</ns0:Categories>

高级计费类型2
高级ASLCode 2
22
2002-02-02
高级计费类型1
高级ASLCode 1
16
2001-01-01
高级计费类型1
高级ASLCode 2
121.11
2001-01-01
高级计费类型1
高级ASLCode 1
112.22
2002-02-02
高级计费类型3
高级ASLCode 3
33
2003-03-03
税单类型4
税务代码4
44
2004-04-04
税单收费类型5
税务代码5
55
2005-05-05
收费类型6
费用代码6
66
2006-06-06
测绘要求如下: 1.若源xml中的Category元素的值为“Premium”,那个么它应该映射到Categories/Premium下的destination。 2.若源xml中的Category元素的值为“Tax”,那个么它应该映射到Categories/Tax下的destination。 3.若源xml中的Category元素的值为“Fee”,那个么它应该映射到Categories/Fee下的destination。 4.输出应仅具有按类别、计费类型、ALSCode和生效日期划分的不同记录集。 5.输出应按类别、计费类型、ALSCode和生效日期在目标节点“金额”中具有源节点“DeltaAmount”的聚合值

在示例xml中,我包含了一个“Premium”节点的聚合示例,例如

<BillingChargeType>premium BillingChargeType 1</BillingChargeType>
<ASLCode>premium ASLCode 1</ASLCode>
<EffectiveDate>2001-01-01</EffectiveDate>
premium BillingChargeType 1
高级ASLCode 1
2001-01-01
有两个覆盖记录集具有以上3个节点。这两者的区别在于

<DeltaAmount>11.00</DeltaAmount> and <DeltaAmount>5.00</DeltaAmount>
11.00和5.00
在预期的输出中,您将看到只有一个节点映射为DeltaAmount node=16

我尝试在xslt中使用key、distinct和generate-id以及apply模板和for-each循环进行映射,但没有得到我们想要的结果。所以我在这里请求你的帮助。如果你需要更多信息,请告诉我

感谢您的关注,感谢您的帮助!
Mukund

您可以在映射中使用全局变量,在方法上方的脚本functoid中声明列表或数组。您可以使用它来跟踪已映射的类别

该方法将返回一个连接到输出节点premium and taxes的布尔值。它接受类别,检查集合,如果找到,则返回false,否则添加并返回true

System.Collections.Generic.List<string> categories;

public string AddToArray(string cat)
{
    if (categories == null)
    {
        categories = new System.Collections.Generic.List<string>();
    }

    if(!categories.Contains(cat))
    {
        categories.Add(cat);
        return true;
    }

    return false;
 }
System.Collections.Generic.List类别;
公共字符串AddToArray(字符串类别)
{
如果(类别==null)
{
categories=new System.Collections.Generic.List();
}
如果(!categories.Contains(cat))
{
类别。添加(cat);
返回true;
}
返回false;
}

如果有人感兴趣,下面是我从另一条线上的某个人那里得到的答案副本

<?xml version="1.0" encoding="utf-8"?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
 xmlns:ns0="http://BizTalkTestProject.SourceSchema">
   <xsl:output method="xml" indent="yes"/>
   <xsl:key name="group" match="/ns0:Coverages/Coverage" use="concat(BillingChargeType,Category,ASLCode,EffectiveDate)"/>  
   <xsl:template match="/ns0:Coverages">
     <ns0:Categories xmlns:ns0="http://BizTalkTestProject.DestinationSchema">      
       <xsl:for-each select="Coverage[count(. | key('group', concat(BillingChargeType, Category,ASLCode,EffectiveDate))[1]) = 1]">
         <xsl:choose>
           <xsl:when test="./Category ='premium'">
               <ns0:Premium>
                 <ns0:CategoryDetail>
                   <Type>
                     <xsl:value-of select="./BillingChargeType"/>
                   </Type>
                   <AnnualStatementLine>
                     <xsl:value-of select="./ASLCode"/>
                   </AnnualStatementLine>
                   <Amount>
                     <xsl:value-of select="format-number(sum(key('group', concat(BillingChargeType, Category,ASLCode,EffectiveDate))/DeltaAmount),'#,###.00')"/>
                   </Amount>
                   <ChangeEffectiveDate>
                     <xsl:value-of select="./EffectiveDate"/>
                   </ChangeEffectiveDate>

                </ns0:CategoryDetail>
               </ns0:Premium>            
           </xsl:when>
           <xsl:when test="./Category ='tax'">            
               <Tax>
                 <CategoryDetail>

                  <Type>
                     <xsl:value-of select="./BillingChargeType"/>
                   </Type>
                   <AnnualStatementLine>
                     <xsl:value-of select="./ASLCode"/>
                   </AnnualStatementLine>
                   <Amount>
                     <xsl:value-of select="format-number(sum(key('group', concat(BillingChargeType, Category,ASLCode,EffectiveDate))/DeltaAmount),'#,###.00')"/>
                   </Amount>
                   <ChangeEffectiveDate>
                     <xsl:value-of select="./EffectiveDate"/>
                   </ChangeEffectiveDate>

                </CategoryDetail>
               </Tax>

          </xsl:when>
           <xsl:when test="./Category ='fee'">            
               <fee>
                 <CategoryDetail>

                  <Type>
                     <xsl:value-of select="./BillingChargeType"/>
                   </Type>
                   <AnnualStatementLine>
                     <xsl:value-of select="./ASLCode"/>
                   </AnnualStatementLine>
                   <Amount>
                     <xsl:value-of select="format-number(sum(key('group', concat(BillingChargeType, Category,ASLCode,EffectiveDate))/DeltaAmount),'#,###.00')"/>
                   </Amount>
                   <ChangeEffectiveDate>
                     <xsl:value-of select="./EffectiveDate"/>
                   </ChangeEffectiveDate>
                 </CategoryDetail>
               </fee>            
           </xsl:when>
         </xsl:choose>
       </xsl:for-each>
     </ns0:Categories>
   </xsl:template>
 </xsl:stylesheet>