splitting a message into multiple messages

Home Page Forums BizTalk 2004 – BizTalk 2010 splitting a message into multiple messages

Viewing 1 reply thread
  • Author
    Posts
    • #12883

      using this xslt from one of the samples i found, it splits a message into multiple messages based on RequestedDate.

      How would i change this xslt to include another attribute; like Qty for instance?

      <xsl:stylesheet xmlns:xsl=\”http://www.w3.org/1999/XSL/Transform\” xmlns:msxsl=\”urn:schemas-microsoft-com:xslt\” exclude-result-prefixes=\”msxsl\” version=\”1.0\” xmlns:ns0=\”http://BizTalk.Enthusiast.LogicalSplitter.Orders\” xmlns:ns1=\”http://BizTalk.Enthusiast.LogicalSplitter.Order\”>
      <xsl:output omit-xml-declaration=\”yes\” version=\”1.0\” method=\”xml\” />
      <xsl:key name=\”linekey\” match=\”/ns1:Order/Line\” use=\”@RequestedDate\”/>
      <xsl:template match=\”/\”>
      <xsl:apply-templates select=\”/ns1:Order\” />
      </xsl:template>
      <xsl:template match=\”/ns1:Order\”>
      <ns0:Orders>
      <xsl:for-each select=\”Line\”>
      <xsl:variable name=\”group\” select=\”key(‘linekey’, @RequestedDate)\”/>
      <xsl:if test=\”generate-id($group[1]) = generate-id()\”>
      <ns1:Order>
      <Header>
      <xsl:attribute name=\”OrderNo\”>
      <xsl:value-of select=\”ancestor::*[1]/Header/@OrderNo\” />
      </xsl:attribute>
      <xsl:attribute name=\”OrderDate\”>
      <xsl:value-of select=\”ancestor::*[1]/Header/@OrderDate\” />
      </xsl:attribute>
      </Header>
      <xsl:for-each select=\”$group\”>
      <Line>
      <xsl:attribute name=\”Item\”>
      <xsl:value-of select=\”@Item\” />
      </xsl:attribute>
      <xsl:attribute name=\”RequestedDate\”>
      <xsl:value-of select=\”@RequestedDate\” />
      </xsl:attribute>
      <xsl:attribute name=\”Qty\”>
      <xsl:value-of select=\”@Qty\” />
      </xsl:attribute>
      <xsl:attribute name=\”ExtendedPrice\”>
      <xsl:value-of select=\”@ExtendedPrice\” />
      </xsl:attribute>
      </Line>
      </xsl:for-each>
      <Footer NoLines=\”{count($group) }\” TotalQty=\”{sum($group/@Qty)}\” TotalAmount=\”{format-number(sum($group/@ExtendedPrice), ‘####.00’)}\” />
      </ns1:Order>
      </xsl:if>
      </xsl:for-each>
      </ns0:Orders>
      </xsl:template>
      </xsl:stylesheet>

      Thanks
      Ryan

    • #12884

      Change the key settings

      <xsl:key name=\”linekey\” match=\”/ns1:Order/Line\” use=\”concat(@RequestedDate,@Qty)\”/>

      and

      <xsl:variable name=\”group\” select=\”key(‘linekey’, concat(@RequestedDate,@Qty))\”/>

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.