I spent quite some time trying to get muenchian grouping of the below xml to work but I can't get it to work. I tried a number of different ways so posting the most recent attempt probably just confuses anyone trying to help me. :-)
Xslt needs to be 1.0
Input file is invoice lines where "invoice header info" is duplicated for each line belonging to a particular invoice.
Grouping should be made in field _id, i e value in RESULTSET/ROW"/COL[12]/DATA (e. g. 'C82F1B47-9758-4D18-ABD7-80386385F6AD')
COL[21] through COL[27] are the different invoice lines for the invoice and as such should be listed line by line and under the respective invoice.
Input xml (it is from Filemaker):
<?xml version="1.0" encoding="UTF-8" ?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="01-22-2016" NAME="FileMaker" VERSION="ProAdvanced 14.0.5"/>
<DATABASE DATEFORMAT="Yyyy-m-d" LAYOUT="" NAME="fmStaben.fmp12" RECORDS="113" TIMEFORMAT="k:mm:ss "/>
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_MEMBER" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_MEDLEM_KSIFFER" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_FIRST_NAME" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_LAST_NAME" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_FIRST_PNAME" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_LAST_PNAME" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_ADDRESS1" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_ADDRESS2" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_ZIP" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_CITY" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_STATE" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::_id" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_ORDERNR" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_POSTAGE" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_ORDER_TOTAL" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_DISCOUNT" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_MVA_AMOUNT" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_AMOUNT_TO_PAY" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_KID" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderHeader::OH_AMOUNT_MODUS" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OL_LINE" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OL_LTYPE" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OL_ART_NR" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OL_ART_TEXT" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OL_QUANTITY" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OL_PRICE" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OL_TOTAL" TYPE="NUMBER"/>
</METADATA>
<RESULTSET FOUND="6">
<ROW MODID="0" RECORDID="601">
<COL>
<DATA>109948</DATA>
</COL>
<COL>
<DATA>45</DATA>
</COL>
<COL>
<DATA>JOHN</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>JAMES</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>2323 MAIN STREET</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>999 99</DATA>
</COL>
<COL>
<DATA>MAGIC KINGDOM</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>C82F1B47-9758-4D18-ABD7-80386385F6AD</DATA>
</COL>
<COL>
<DATA>409949</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>3534534534517</DATA>
</COL>
<COL>
<DATA>7</DATA>
</COL>
<COL>
<DATA>010</DATA>
</COL>
<COL>
<DATA>A</DATA>
</COL>
<COL>
<DATA>99-131015DM</DATA>
</COL>
<COL>
<DATA>WORLD CUP KIT 1</DATA>
</COL>
<COL>
<DATA>1</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
</ROW>
<ROW MODID="0" RECORDID="602">
<COL>
<DATA>109948</DATA>
</COL>
<COL>
<DATA>45</DATA>
</COL>
<COL>
<DATA>JOHN</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>JAMES</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>2323 MAIN STREET</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>999 99</DATA>
</COL>
<COL>
<DATA>MAGIC KINGDOM</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>C82F1B47-9758-4D18-ABD7-80386385F6AD</DATA>
</COL>
<COL>
<DATA>409949</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>3534534534517</DATA>
</COL>
<COL>
<DATA>7</DATA>
</COL>
<COL>
<DATA>020</DATA>
</COL>
<COL>
<DATA>A</DATA>
</COL>
<COL>
<DATA>99-140312DM</DATA>
</COL>
<COL>
<DATA>WORLD CUP KIT 2</DATA>
</COL>
<COL>
<DATA>1</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
</ROW>
<ROW MODID="0" RECORDID="603">
<COL>
<DATA>049985</DATA>
</COL>
<COL>
<DATA>77</DATA>
</COL>
<COL>
<DATA>TEST</DATA>
</COL>
<COL>
<DATA>VON TEST</DATA>
</COL>
<COL>
<DATA>TESTPARENT</DATA>
</COL>
<COL>
<DATA>VON TEST</DATA>
</COL>
<COL>
<DATA>789 LEFT STREET</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>999 99</DATA>
</COL>
<COL>
<DATA>MAGIC KINGDOM</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>5A2D83C6-ECEB-4636-968E-97DC6E5B1C8A</DATA>
</COL>
<COL>
<DATA>409950</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>92350429953250</DATA>
</COL>
<COL>
<DATA>7</DATA>
</COL>
<COL>
<DATA>010</DATA>
</COL>
<COL>
<DATA>A</DATA>
</COL>
<COL>
<DATA>99-140312DM</DATA>
</COL>
<COL>
<DATA>WORLD CUP KIT 3</DATA>
</COL>
<COL>
<DATA>1</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
</ROW>
<ROW MODID="0" RECORDID="605">
<COL>
<DATA>129984</DATA>
</COL>
<COL>
<DATA>15</DATA>
</COL>
<COL>
<DATA>CARL</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>JANE</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>4525 GREAT ROAD</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>999 99</DATA>
</COL>
<COL>
<DATA>MAGIC KINGDOM</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>478E8CF0-7C93-4BE4-B314-FBCBDB5184F0</DATA>
</COL>
<COL>
<DATA>409951</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>92359999843251</DATA>
</COL>
<COL>
<DATA>7</DATA>
</COL>
<COL>
<DATA>020</DATA>
</COL>
<COL>
<DATA>A</DATA>
</COL>
<COL>
<DATA>99-1407156</DATA>
</COL>
<COL>
<DATA>150 FOOTBALL LEGENDS</DATA>
</COL>
<COL>
<DATA>1</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
</ROW>
<ROW MODID="0" RECORDID="606">
<COL>
<DATA>129984</DATA>
</COL>
<COL>
<DATA>15</DATA>
</COL>
<COL>
<DATA>CARL</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>JANE</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>4525 GREAT ROAD</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>999 99</DATA>
</COL>
<COL>
<DATA>MAGIC KINGDOM</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>478E8CF0-7C93-4BE4-B314-FBCBDB5184F0</DATA>
</COL>
<COL>
<DATA>409951</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>92359999843251</DATA>
</COL>
<COL>
<DATA>7</DATA>
</COL>
<COL>
<DATA>030</DATA>
</COL>
<COL>
<DATA>A</DATA>
</COL>
<COL>
<DATA>99-140312DM</DATA>
</COL>
<COL>
<DATA>WORLD CUP KIT 3</DATA>
</COL>
<COL>
<DATA>1</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
</ROW>
<ROW MODID="0" RECORDID="607">
<COL>
<DATA>129984</DATA>
</COL>
<COL>
<DATA>15</DATA>
</COL>
<COL>
<DATA>CARL</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>JANE</DATA>
</COL>
<COL>
<DATA>DOE</DATA>
</COL>
<COL>
<DATA>4525 GREAT ROAD</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>999 99</DATA>
</COL>
<COL>
<DATA>MAGIC KINGDOM</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>478E8CF0-7C93-4BE4-B314-FBCBDB5184F0</DATA>
</COL>
<COL>
<DATA>409951</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA/>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>49,00</DATA>
</COL>
<COL>
<DATA>92359999843251</DATA>
</COL>
<COL>
<DATA>7</DATA>
</COL>
<COL>
<DATA>040</DATA>
</COL>
<COL>
<DATA>A</DATA>
</COL>
<COL>
<DATA>99-1402175</DATA>
</COL>
<COL>
<DATA>WORLD CUP KIT 2</DATA>
</COL>
<COL>
<DATA>1</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
<COL>
<DATA>0,00</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
Needed output xml:
<?xml version="1.0" encoding="UTF-8" ?>
<Invoices>
<Invoice>
<Recipient>
<MemberNo>109948</MemberNo>
<CheckDigit>99</CheckDigit>
<FirstName>JOHN</FirstName>
<LastName>DOE</LastName>
<GuardianFirstName>JAMES</GuardianFirstName>
<GuardianLastName>DOE</GuardianLastName>
<Address1>2323 MAIN STREET</Address1>
<Address2/>
<PostalCode>999 99</PostalCode>
<City>MAGIC KINGDOM</City>
<State/>
</Recipient>
<InvoiceHeader>
<OrderNo>409949</OrderNo>
<Postage>49,00</Postage>
<OrderTotal>49,00</OrderTotal>
<Discount/>
<VATAmount>0,00</VATAmount>
<AmountToPay>49,00</AmountToPay>
<PaymentReferenceNo>3534534534517</PaymentReferenceNo>
<AmountModus>7</AmountModus>
</InvoiceHeader>
<InvoiceLines>
<InvoiceLine>
<LineNo>010</LineNo>
<LineType>A</LineType>
<ItemNo>99-131015DM</ItemNo>
<ItemDescription>WORLD CUP KIT 1</ItemDescription>
<Quantity>1</Quantity>
<UnitPrice>0,00</UnitPrice>
<LineAmount>0,00</LineAmount>
</InvoiceLine>
<InvoiceLine>
<LineNo>020</LineNo>
<LineType>A</LineType>
<ItemNo>99-140312DM</ItemNo>
<ItemDescription>WORLD CUP KIT 2</ItemDescription>
<Quantity>1</Quantity>
<UnitPrice>0,00</UnitPrice>
<LineAmount>0,00</LineAmount>
</InvoiceLine>
</InvoiceLines>
</Invoice>
<Invoice>
<Recipient>
<MemberNo>049985</MemberNo>
<CheckDigit>77</CheckDigit>
<FirstName>TEST</FirstName>
<LastName>VON TEST</LastName>
<GuardianFirstName>TESTPARENT</GuardianFirstName>
<GuardianLastName>VON TEST</GuardianLastName>
<Address1>789 LEFT STREET</Address1>
<Address2/>
<PostalCode>999 99</PostalCode>
<City>MAGIC KINGDOM</City>
<State/>
</Recipient>
<InvoiceHeader>
<OrderNo>409950</OrderNo>
<Postage>49,00</Postage>
<OrderTotal>49,00</OrderTotal>
<Discount/>
<VATAmount>0,00</VATAmount>
<AmountToPay>49,00</AmountToPay>
<PaymentReferenceNo>92350429953250</PaymentReferenceNo>
<AmountModus>7</AmountModus>
</InvoiceHeader>
<InvoiceLines>
<InvoiceLine>
<LineNo>010</LineNo>
<LineType/>
<ItemNo>99-140312DM</ItemNo>
<ItemDescription>WORLD CUP KIT 3</ItemDescription>
<Quantity>1</Quantity>
<UnitPrice>0,00</UnitPrice>
<LineAmount>0,00</LineAmount>
</InvoiceLine>
</InvoiceLines>
</Invoice>
<Invoice>
<Recipient>
<MemberNo>129984</MemberNo>
<CheckDigit>15</CheckDigit>
<FirstName>CARL</FirstName>
<LastName>DOE</LastName>
<GuardianFirstName>JANE</GuardianFirstName>
<GuardianLastName>DOE</GuardianLastName>
<Address1>4525 GREAT ROAD</Address1>
<Address2/>
<PostalCode>999 99</PostalCode>
<City>MAGIC KINGDOM</City>
<State/>
</Recipient>
<InvoiceHeader>
<OrderNo>409951</OrderNo>
<Postage>49,00</Postage>
<OrderTotal>49,00</OrderTotal>
<Discount/>
<VATAmount>0,00</VATAmount>
<AmountToPay>49,00</AmountToPay>
<PaymentReferenceNo>92359999843251</PaymentReferenceNo>
<AmountModus>7</AmountModus>
</InvoiceHeader>
<InvoiceLines>
<InvoiceLine>
<LineNo>020</LineNo>
<LineType>A</LineType>
<ItemNo>99-1407156</ItemNo>
<ItemDescription>150 FOOTBALL LEGENDS</ItemDescription>
<Quantity>1</Quantity>
<UnitPrice>0,00</UnitPrice>
<LineAmount>0,00</LineAmount>
</InvoiceLine>
<InvoiceLine>
<LineNo>030</LineNo>
<LineType>A</LineType>
<ItemNo>99-140312DM</ItemNo>
<ItemDescription>WORLD CUP KIT 3</ItemDescription>
<Quantity>1</Quantity>
<UnitPrice>0,00</UnitPrice>
<LineAmount>0,00</LineAmount>
</InvoiceLine>
<InvoiceLine>
<LineNo>040</LineNo>
<LineType>A</LineType>
<ItemNo>99-1402175</ItemNo>
<ItemDescription>WORLD CUP KIT 2</ItemDescription>
<Quantity>1</Quantity>
<UnitPrice>0,00</UnitPrice>
<LineAmount>0,00</LineAmount>
</InvoiceLine>
</InvoiceLines>
</Invoice>
</Invoices>
Xlst that I usually use as a base to get the values from the input xml. I used it on several other occasions when I didn't need to group the data (and formating of output was a bit different):
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
exclude-result-prefixes="fmp"
>
<xsl:output method="xml" indent="yes" />
<xsl:template match="/fmp:FMPXMLRESULT">
<Invoices>
<xsl:apply-templates select="fmp:RESULTSET/fmp:ROW" />
</Invoices>
</xsl:template>
<xsl:template match="fmp:RESULTSET/fmp:ROW">
<Invoice>
<Recipient>
<MemberNo>
<xsl:apply-templates select="fmp:COL[1]" />
</MemberNo>
<CheckDigit>
<xsl:apply-templates select="fmp:COL[2]" />
</CheckDigit>
<FirstName>
<xsl:apply-templates select="fmp:COL[3]" />
</FirstName>
<LastName>
<xsl:apply-templates select="fmp:COL[4]" />
</LastName>
<GuardianFirstName>
<xsl:apply-templates select="fmp:COL[5]" />
</GuardianFirstName>
<GuardianLastName>
<xsl:apply-templates select="fmp:COL[6]" />
</GuardianLastName>
<Address1>
<xsl:apply-templates select="fmp:COL[7]" />
</Address1>
<Address2>
<xsl:apply-templates select="fmp:COL[8]" />
</Address2>
<PostalCode>
<xsl:apply-templates select="fmp:COL[9]" />
</PostalCode>
<City>
<xsl:apply-templates select="fmp:COL[10]" />
</City>
<State>
<xsl:apply-templates select="fmp:COL[11]" />
</State>
</Recipient>
<InvoiceHeader>
<OrderNo>
<xsl:apply-templates select="fmp:COL[12]" />
</OrderNo>
<Postage>
<xsl:apply-templates select="fmp:COL[13]" />
</Postage>
<OrderTotal>
<xsl:apply-templates select="fmp:COL[14]" />
</OrderTotal>
<Discount>
<xsl:apply-templates select="fmp:COL[15]" />
</Discount>
<VATAmount>
<xsl:apply-templates select="fmp:COL[16]" />
</VATAmount>
<AmountToPay>
<xsl:apply-templates select="fmp:COL[17]" />
</AmountToPay>
<PaymentReferenceNo>
<xsl:apply-templates select="fmp:COL[18]" />
</PaymentReferenceNo>
<AmountModus>
<xsl:apply-templates select="fmp:COL[19]" />
</AmountModus>
</InvoiceHeader>
<InvoiceLines>
<InvoiceLine>
<LineNo>
<xsl:apply-templates select="fmp:COL[20]" />
</LineNo>
<LineType>
<xsl:apply-templates select="fmp:COL[21]" />
</LineType>
<ItemNo>
<xsl:apply-templates select="fmp:COL[22]" />
</ItemNo>
<ItemDescription>
<xsl:apply-templates select="fmp:COL[23]" />
</ItemDescription>
<Quantity>
<xsl:apply-templates select="fmp:COL[24]" />
</Quantity>
<UnitPrice>
<xsl:apply-templates select="fmp:COL[25]" />
</UnitPrice>
<LineAmount>
<xsl:apply-templates select="fmp:COL[26]" />
</LineAmount>
</InvoiceLine>
</InvoiceLines>
</Invoice>
</xsl:template>
<!-- the key indexes the METADATA fields by their position -->
<xsl:key
name="kMetaData"
match="fmp:METADATA/fmp:FIELD"
use="count(preceding-sibling::fmp:FIELD) + 1"
/>
<!-- OrderHeader::OH_MEMBER -->
<xsl:template match="fmp:COL[1]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_MEDLEM_KSIFFER -->
<xsl:template match="fmp:COL[2]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_FIRST_NAME -->
<xsl:template match="fmp:COL[3]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_LAST_NAME -->
<xsl:template match="fmp:COL[4]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_FIRST_PNAME -->
<xsl:template match="fmp:COL[5]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_LAST_PNAME -->
<xsl:template match="fmp:COL[6]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_ADDRESS1 -->
<xsl:template match="fmp:COL[7]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_ADDRESS2 -->
<xsl:template match="fmp:COL[8]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_ZIP -->
<xsl:template match="fmp:COL[9]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_CITY -->
<xsl:template match="fmp:COL[10]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_STATE -->
<xsl:template match="fmp:COL[11]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::_id -->
<xsl:template match="fmp:COL[12]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_ORDERNO -->
<xsl:template match="fmp:COL[13]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_POSTAGE -->
<xsl:template match="fmp:COL[14]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_ORDER_TOTAL -->
<xsl:template match="fmp:COL[15]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_DISCOUNT -->
<xsl:template match="fmp:COL[16]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_MVA_AMOUNT -->
<xsl:template match="fmp:COL[17]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_AMOUNT_TO_PAY -->
<xsl:template match="fmp:COL[18]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_KID -->
<xsl:template match="fmp:COL[19]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OrderHeader::OH_AMOUNT_MODUS -->
<xsl:template match="fmp:COL[20]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OL_LINE -->
<xsl:template match="fmp:COL[21]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OL_LTYPE -->
<xsl:template match="fmp:COL[22]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OL_ART_NR -->
<xsl:template match="fmp:COL[23]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OL_ART_TEXT -->
<xsl:template match="fmp:COL[24]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OL_QUANTITY -->
<xsl:template match="fmp:COL[25]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OL_PRICE -->
<xsl:template match="fmp:COL[26]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
<!-- OL_TOTAL -->
<xsl:template match="fmp:COL[27]">
<xsl:value-of select="fmp:DATA" />
</xsl:template>
</xsl:stylesheet>
Thanks you in advance to anyone beeing so kind as to take time to help me. :-) //Freppan
You don't need to use Muenchian grouping if you're doing the XSL transformation while exporting from FileMaker. You can take advantage of the EXSLT
set:distinct()
extension function that FileMaker's XSLT engine supports:XSLT 1.0
Well, given that you know the item you want to group by it should not be that difficult to define your key
<xsl:key name="group" match="fmp:ROW" use="fmp:COL[12]/fmp:DATA"/>
and use it:I reused your code (had to increment some positional predicates), I would consider cleaning up all those
<xsl:apply-templates select="fmp:COL[N]"/>
to simply use<xsl:value-of select="fmp:COL[N]/fmp:DATA"/>
however, as in this case the pushing the processing to a template does not really achieve some transformation.