Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Problems grouping using keys and the Muenchian Method

From: MEC6304@-----------.---------.---
To: NULL
Date: 7/6/2004 9:44:00 AM
I've got the following XML fragment repeated multiple times:
<SKU_INFO>
    <DETAIL_SEQ_NUMBER>11</DETAIL_SEQ_NUMBER>
    <SKU_TIE>1</SKU_TIE>
    <SKU_NUMBER>223344</SKU_NUMBER>
    <SKU_QUANTITY>2</SKU_QUANTITY>
    <MFG_PART_NUM>1234A</MFG_PART_NUM>
    <ITEM_TYPE_CODE>N</ITEM_TYPE_CODE>
    <SKU_DESCRIPTION>SI,MOD</SKU_DESCRIPTION>
    <BASE_SKU_FLAG>y</BASE_SKU_FLAG>
  </SKU_INFO>
  <SKU_INFO>
    <DETAIL_SEQ_NUMBER>11</DETAIL_SEQ_NUMBER>
    <SKU_TIE>1</SKU_TIE>
    <SKU_NUMBER>113344</SKU_NUMBER>
    <SKU_QUANTITY>2</SKU_QUANTITY>
    <MFG_PART_NUM>1234A</MFG_PART_NUM>
    <ITEM_TYPE_CODE>6</ITEM_TYPE_CODE>
    <SKU_DESCRIPTION>MOD</SKU_DESCRIPTION>
    <BASE_SKU_FLAG />
  </SKU_INFO>
  <SKU_INFO>.....
I'm attempting to group by the SKU_NUMBER element using keys but have been unable to get this to work. Here's my xslt:
<ROWSET>
    <xsl:for-each select="SKU_INFO[count(. | key('sku_num', SKU_NUMBER)[1]) = 1]" >
	<ROW> 					
		<xsl:attribute name="num">
      		<xsl:value-of select="position()"/> 
   		</xsl:attribute>
   	<ROW> 
	<HEADER_ID>
		<xsl:value-of select="/CustomerOrder/headerID" />
	</HEADER_ID>
        <DETAIL_SEQ_NUMBER>
		<xsl:value-of select="./DETAIL_SEQ_NUMBER" />
	</DETAIL_SEQ_NUMBER>
	<SKU_TIE>
		<xsl:value-of select="./SKU_TIE" />
	</SKU_TIE>
	<SKU_NUMBER>
		<xsl:value-of select="./SKU_NUMBER" />
	</SKU_NUMBER>
	<SKU_QTY>
		<xsl:value-of select="./SKU_QUANTITY" />
	</SKU_QTY>
	<MFG_PART_NUM>
		<xsl:value-of select="./MFG_PART_NUM" />
	</MFG_PART_NUM>
	<ITEM_TYPE_CODE>
		<xsl:value-of select="./ITEM_TYPE_CODE" />
	</ITEM_TYPE_CODE>
	<SKU_DESCRIPTION>
		<xsl:value-of select="./SKU_DESCRIPTION" />
	</SKU_DESCRIPTION>
	<BASE_SKU_FLAG>
		<xsl:choose>
		<xsl:when test="./BASE_SKU_FLAG='Y' " >
			<xsl:text>1</xsl:text>
		</xsl:when>
		<xsl:otherwise>
			<xsl:text>0</xsl:text>
		</xsl:otherwise>
		</xsl:choose>
	</BASE_SKU_FLAG>
	<UPDATE_DATE>
		<xsl:value-of select="$updateDate" />
	</UPDATE_DATE> 
     	</ROW>
</xsl:for-each> 
</ROWSET>

Any help is greatly appreciated, thanks.
MEC6304


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent