Orchestration Variable in Custom XSLT in Biztalk Map

Hi,
I have a custom xslt for mapping HL7 messages to CRM fields.
For one field, I 'll get the data from DB so it is stored in my orchestration variable. How can I use that variable in my custom xslt file? Thanks.
Regards,
Lakshmi

Hi Laxme,
As far I know, there is no way you can access Orchestration variable in custom XSLT.
Workaround : you can create a intermediate message with a field and assign the variable value (the data from DB) to it and later use message assignment to assign this value to the field which you want to the mesage which you created using custom
xslt.
Maheshkumar
S Tiwari|User
Page|Blog|BizTalk
2013: Inserting RawXML (Whole Incoming XML Message) in SQL database

Similar Messages

  • Custom XSLT for Biztalk Maps

    Hi,
    I have a input xml file and the output xml file. The input message is multi-part message.
    I have to create a custom xslt to convert input xml to output xml. The xslt should give an xml output. I have an another xslt to take this output as input and create the output in html form.
    Is there any way to convert the existing xslt (which give html output) to the xslt which has to create xml output.
    Thanks,
    Lakshmi

    Hi Lakshmi,
    You can the HTML-XSLT (used to output HTML ) as reference for outputting XML in BizTalk but there is no easy way to achieve it with help of any tool. Especially around the XPaths which can going to be similar.
    For instance, following an XSLT for outputting HTML
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://biztalk.orderapp.schemas.OrderResponse">
    <xsl:template match="/">
    <html>
    <body>
    <TABLE BORDER="0" cellspacing="2" cellpadding="2" width="90%">
    <TR>
    <TD colspan="8" align="center">
    <H1>Order Confirmation</H1>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Order no : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:OrderHeader/ns0:OrderNumber/text()"/>
    </TD>
    </TR>
    </TABLE>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    And following an XSLT for outputting XML in BizTalk. You can see the similarities in XPATH and difference around the places they have been used to output HTML and XML.
    <?xml version="1.0" encoding="UTF-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:ns0="http://biztalk.orderapp.schemas.OrderResponse" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" version="1.0">
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/s3:Registration" />
    </xsl:template>
    <xsl:template match="/ns0:OrderConfirmation">
    <ns0:OrderConfirmation>
    <OrderNoo>
    <xsl:value-of select="ns0:OrderHeader/ns0:OrderNumber/text()" />
    </OrderNo>
    </ns0:Output>
    </xsl:template>
    </xsl:stylesheet>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Using custom xslt file for mapping

    I have a map using custom xsl. I deployed it to different enviroment. When my BTS application ran, it complained
    There was a failure executing the receive pipeline: "WS.Pipeline.MsgTransformDebatchPipeline, WS.Pipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c7f3bdebaae529db" Source: "MsgTransformDecoder" Receive Port: "WS_Debatch"
    URI: "C:\TestData\WS\InternalInput\*_batch.xml" Reason: Could not find file 'C:\WS\BTS\WS.Map\BatchOrder_to_CanonicalBatchOrder.xsl'.
    I have to create corresponding path and copy my xsl file there to make it work. Why?
    I tried Microsoft.Samples.BizTalk.ExtendingMapper.OverridingMapXslt sample. I compiled and deployed it, then I modified OverridingMapXslt.xslt to OverridingMapXslt2.xslt. I dropped input file and there was no complaint about missing OverridingMapXslt.xslt.
    I thought .xsl is treated like any other source code file and is compiled into the assembly at build time. Why I got this error?
    Thanks in advance!!!

    Unless you've compiled the .xsl into your custom component as a Resource, then yes, that exact path has to exist anywhere it will run.
    However, as la Cour points out, a BizTalk Map has a Custom XSLT Path property that will take care of that for you.

  • BizTalk Map: Grouping CRM Response XML based on the ID field in Custom XSLT

    Hi,
    I will receive a CRM response as below. 
    <ns0:RetrieveMultipleResponse xmlns:ns0="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:ns2="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns3="http://schemas.microsoft.com/xrm/2011/Metadata" xmlns:ns5="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" xmlns:ns4="http://schemas.microsoft.com/xrm/2011/Contracts"><ns0:RetrieveMultipleResult>    <ns4:Entities>      <ns4:Entity>        <b:Attributes xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">            <b:KeyValuePairOfstringanyType>            <c:key>ccx_datevaccineinfostatementpresented</c:key>            <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">2012-08-14T04:00:00Z</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_administeredamount</c:key>            <c:value i:type="d:decimal" xmlns:d="http://www.w3.org/2001/XMLSchema">0.75000000</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_immunizationid</c:key>            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">826c2b0e-a349-e411-866c-00155d1e1f77</c:value>          </b:KeyValuePairOfstringanyType>     </b:Attributes>  </ns4:Entity>   <ns4:Entity>        <b:Attributes xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">            <b:KeyValuePairOfstringanyType>            <c:key>ccx_datevaccineinfostatementpresented</c:key>            <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">2012-08-14T04:00:00Z</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_administeredamount</c:key>            <c:value i:type="d:decimal" xmlns:d="http://www.w3.org/2001/XMLSchema">0.25000</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_immunizationid</c:key>            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">766c2b0e-a349-e411-866c-00155d1e1f77</c:value>          </b:KeyValuePairOfstringanyType>     </b:Attributes>  </ns4:Entity><ns4:Entity>        <b:Attributes xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">            <b:KeyValuePairOfstringanyType>            <c:key>ccx_datevaccineinfostatementpresented</c:key>            <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">2012-08-14T04:00:00Z</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_administeredamount</c:key>            <c:value i:type="d:decimal" xmlns:d="http://www.w3.org/2001/XMLSchema">0.7500000000</c:value>          </b:KeyValuePairOfstringanyType>          <b:KeyValuePairOfstringanyType>            <c:key>ccx_immunizationid</c:key>            <c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">826c2b0e-a349-e411-866c-00155d1e1f77</c:value>          </b:KeyValuePairOfstringanyType>     </b:Attributes>  </ns4:Entity></Entities></ns0:RetrieveMultipleResult></ns0:RetrieveMultipleResponse>
    I have  to count the distinct Entities based on ccx_immunizationid value & also I have to group the fields if both entity has same immunization ID. If the xml file (without namespace) and the field is <ccx_immunizationid>2323</ccx_imunizationid>,
    I can use something like below,
    <xsl:template match="//Entity/Attributes[not(./ccx_immunizationid= preceding::ccx_immunizationid)]">
    but here, I have to look for the key 'ccx_immunizationid' and its value. 
    I am using custom xslt in BizTalk map. Please help. Thanks.
    Regards,
    Lakshmi

    You need to get the distinct record filtered by "value" field whose "key" is "ccx_immunizationid" i.e <c:key>ccx_immunizationid</c:key>".
    So you need to use the XPath with syntax: 
    /*[not(@name = preceding::*/@name)]
    So in your case, the XPath value will be like the following:
    /*[local-name()='RetrieveMultipleResponse' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts/Services']/*[local-name()='RetrieveMultipleResult' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts/Services']/*[local-name()='Entities' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts']/*[local-name()='Entity' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts']/*[local-name()='Attributes' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts']/*[local-name()='KeyValuePairOfstringanyType' and namespace-uri()='http://schemas.microsoft.com/xrm/2011/Contracts'][*[local-name()='key' and namespace-uri()='http://schemas.datacontract.org/2004/07/System.Collections.Generic']/text() ='ccx_immunizationid'][not(*[local-name()='value' and namespace-uri()='http://schemas.datacontract.org/2004/07/System.Collections.Generic'] = preceding::*[local-name()='value' and namespace-uri()='http://schemas.datacontract.org/2004/07/System.Collections.Generic'])]
    You may need to change the namespaces according to yours. This XPath would give you an idea of how to use the distinct XPath (1.0) snystax as shown above in your XML.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Custom xslt

    The following is the custom xslt for a mapping.
    <xsl:template match="/s0:Job">
        <xsl:element name="job" namespace="http://schemas/outbound/1">
            <xsl:attribute name="contract">
            <xsl:value-of select="ContractNumber/text()" />
          </xsl:attribute>
     <xsl:element name="job_lines">
            <xsl:for-each select="ABCs">
              <xsl:for-each select="ABC">
                   <xsl:variable name="var:v12" select="string(DescriptionLine1/text())" />
                <xsl:variable name="var:v13" select="string(DescriptionLine2/text())" />
                <xsl:variable name="var:v14" select="userCSharp:StringConcat($var:v12 , &quot; &quot; , $var:v13)" />
                          <xsl:element name="job_line">
                             <xsl:attribute name="code">
                    <xsl:value-of select="Code/text()" />
                  </xsl:attribute>
                  <xsl:attribute name="description">
                    <xsl:value-of select="$var:v14" />
                  </xsl:attribute>
                </xsl:element>
                </xsl:for-each>
            </xsl:for-each>
          </xsl:element>
         <xsl:element name="job_notes">
            <xsl:for-each select="Notes/Note">
              <xsl:variable name="var:v16" select="position()" />
              <xsl:variable name="var:v17" select="userCSharp:StringConcat(string(Type/text()) , &quot; | &quot; , string(LineNo/text()) , &quot; | &quot; , string(Text/text()))"
    />
              <xsl:element name="job_note">
                <xsl:attribute name="id">
                  <xsl:value-of select="$var:v16" />
                </xsl:attribute>
                <xsl:attribute name="note">
                  <xsl:value-of select="$var:v17" />
                </xsl:attribute>
              </xsl:element>
              </xsl:for-each>
          </xsl:element>
    </xsl:element>
      </xsl:template>
    Currently, the attribute value for description($var:v14) is the concatenation of $var:v12 and $var:v13
     <xsl:attribute name="description">
                    <xsl:value-of select="$var:v14" />
                  </xsl:attribute>
    Could it be possible to also add $var:v16 and $var:v17 to the description? that is , can $var:v14 be the concatenation of $var:v12, $var:v13, $var:v16 and $var:v17?
    Or can the existing description be overwritten with description+notes?
    The current ouput is
    <job contract="1107">
    <job_lines>
    <job_line description="Repair Smoke Detector - Emergency ">
    </job_line>
    </job_lines>
    <job_notes>
    <job_note note=" | | Please be patient as elderly tenant. Please try''and arrive before dark as she does not like''answering the door''''''''''''''" id="1">
    </job_note>
    </job_notes>
    </job>
    Required output is
    <job contract="1107">
    <job_lines>
    <job_line description="Repair Smoke Detector - Emergency 1 | | Please be patient as elderly tenant. Please try''and arrive before dark as she does not like''answering the door'''''''''''''' ">
    </job_line>
    </job_lines>
    <job_notes>
    <job_note note=" | | Please be patient as elderly tenant. Please try''and arrive before dark as she does not like''answering the door''''''''''''''" id="1">
    </job_note>
    </job_notes>
    </job>

    Code similar to the following shall work for you:
    <xsl:variable name="var:v14" select="userCSharp:StringConcatAndReplace(string(DescriptionLine1/text()), &quot; &quot; ,string(DescriptionLine2/text()))" />
    <xsl:variable name="VarConcat">
    <xsl:for-each select="../../Notes/Note">
    <xsl:value-of select="userCSharp:StringConcat(string(Type/text()) , &quot; | &quot; , string(LineNo/text()) , &quot; | &quot; , string(Text/text()))"/>
    </xsl:for-each>
    </xsl:variable>
    <xsl:variable name="var:v110" select="userCSharp:StringConcat(string($var:v14) , &quot;| &quot; , string($VarConcat) )" />
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Error while using custom xslt: Cannot find the script or external object that implements prefix 'ScriptNS0'.

    Hi,
    We had a complex map. Because of some requirement, we used custom xslt on this map. Somehow at runtime that custom xslt is giving below error:
    Cannot find the script or external object that implements prefix 'ScriptNS0'.
    I checked below links, it seems this is a bug in Biztalk 2010/Visual stuio 2010.
    http://sandroaspbiztalkblog.wordpress.com/2012/07/29/biztalk-mapper-patterns-calling-an-external-assembly-from-custom-xslt-in-biztalk-server-2010/
    The above link suggest to add a xml element in the .btm file. I tried that as well but no luck. Can anyone suggest me reason and solution for this?
    Thanks, Girish R. Patil.

    When using the Custom XSLT option, you have to maintain the Extension Xml yourself, just as you would for inline custom Xslt that calls external Assemblies.
    Docs:
    http://msdn.microsoft.com/en-us/library/aa547368.aspx
    Sample:
    http://blog.vertica.dk/2013/03/20/using-custom-xslt-in-biztalk/

  • Xslt to replace map in orchestration

    I have created a map and then created an xslt by validating the map. I have added few more changes to the xslt file after it's been created. Now how do I call the xslt in the transform shape of the orchestration? I do not want the map to be used in orchestration,
    in place of that I want xslt to be used. how do I use xslt in place of map in orchestration?

    You have to use this XSLT along with the map.
    Right-click the map surface, and select Properties.
    Click the ellipsis next to the Custom XSLT Path property, and open the file containing the custom XSLT.
    Compile the map. The XSLT file is included in the BizTalk assembly and does not need to be deployed separately.
    Using External XSLT in the BizTalk Mapper
    If you follow the above way you would execute the XSLT for the transformation. There is no harm is using the map and if you have some complex
    logic in XSLT then the above way would ensure that the XSLT would be used for transformation.
    For some reason if you want the XSLT without the standard map, then only option I can think off is to call an external .NET assembly and call
    the XSLT through it by passing the input message. This way is certainly not a suggested way. Use standard map and invoke custom transformation using your XSLT thru map.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

  • BizTalk mapping for repeating Nodes using XSLT

    Hi,
    I am mapping the source schema to destination schema using Custom XSLT file. I have a repeating node in the Sources schema:
    Period node can repeat any number of times. I am using the XPath in XSLT to map the nodes from source to destination and using the "for-each" loop.
    Destination Schema:
    I want to map "PeriodID" and "Volume" both to the destination node "html:TD". I am using the following XSLT code:
    <xsl:for-each select="/*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']">
    <html:TR class="data0" level="0">
    <html:TD class="data-int" datatype="int">
    <xsl:value-of select="./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='PeriodID' and namespace-uri()='Namespace']"/>
    </html:TD>
    <html:TD class="data-dbl" datatype="dbl">
    <xsl:value-of select="./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='Volume' and namespace-uri()='Namespace']"/>
    </html:TD>
    </html:TR>
    </xsl:for-each>
    I am only getting the first value of both the nodes in every loop.
    I know that we can use the XPath of the actual Node(PeriodID) in "for-each" loop and use value-of="." to get the current values of the node.
    But the problem is I want both the values "PeriodID" and "Volume" repeating in the destination.

    if you use xpath like you did ( imean without index), you will only get 1 record elements each time.
    Either you have to use code like i did, or use index based xpath.
    The code i gave you should work, just try to debug it from visual studio. Because xslt is a case sensitive, check if the code i gave you matches the elements in case sensitive. may be you have to use prefixes like s1, s2 etc as per you xsl file declaration.
    Check you xsl file for prefix declarations.
    you can also try below code, it uses postion() method to get the current for loop index.
    <xsl:for-each select="/*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']">
    <html:TR class="data0" level="0">
    <html:TD class="data-int" datatype="int">
    <xsl:value-of select="(./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='PeriodID' and namespace-uri()='Namespace'])[position()]"/>
    </html:TD>
    <html:TD class="data-dbl" datatype="dbl">
    <xsl:value-of select="(./*[local-name()='RootNode' and namespace-uri()='Namespace']/*[local-name()='Periods' and namespace-uri()='Namespace']/*[local-name()='Period' and namespace-uri()='Namespace']/*[local-name()='Volume' and namespace-uri()='Namespace'])[position()]"/>
    </html:TD>
    </html:TR>
    </xsl:for-each>
    but i insist you to verify for any prefix declarations in you xsl file
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Exit a loop from custom xslt

    My custom xslt is as follows which I am using in my map:
    <?xml version="1.0" encoding="utf-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var"
                    exclude-result-prefixes="msxsl var s0 userCSharp" version="1.0" xmlns:s0="http://Students.Student.SourceSchema"
                    xmlns:ns0="http://Students.Student.DestinationSchema"
                    xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp">
      <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
      <xsl:template match="/">
        <xsl:apply-templates select="/s0:Students" />
      </xsl:template>
      <xsl:template match="/s0:Students">
        <ns0:DestinationDetails>
          <xsl:for-each select="StudentTransactions">
            <xsl:if test="FName='H'">
              <xsl:variable name="var:v104" select="ID"/>
              <xsl:for-each select="/s0:Students/StudentTransactions[FName='D' and ID_Detail=$var:v104]">
                <xsl:variable name="Detail_String" select="string(GL_String/text())"/>
                <xsl:if test="$Detail_String!=''">
                  <Details>
                    <HeaderSegment>
                    </HeaderSegment>
                  </Details>
                  </xsl:if>
              </xsl:for-each>
            </xsl:if>
          </xsl:for-each>
        </ns0:DestinationDetails>
      </xsl:template>
      <msxsl:script language="C#" implements-prefix="userCSharp">
        <![CDATA[
    public string StringConcat(string param0)
       return param0;
    ]]>
      </msxsl:script>
    </xsl:stylesheet>
    I want to break the following loop : 
    <xsl:for-each select="/s0:Students/StudentTransactions[FName='D' and ID_Detail=$var:v104]">
    when  <xsl:if test="$Detail_String!=''"> condition is true.
    Any kind of  help would be appreciated.
    Prakash

    Got your point. The counter is not incrementing because, varialbes are immutable in XSLT, i.e. they can't be changed. I think what you need to do is use the position(). With the
    resultset of For-each, using position()=1 in <xsl:if test="position() =1 , you would just access the first record of the resultset
    from for-each
    If my understanding of your problem is correct, then the following XSLT shall work for you.
    <?xml version="1.0" encoding="utf-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0 userCSharp" version="1.0" xmlns:s0="http://CallTemplate_Increment.StudentSchema" xmlns:ns0="http://CallTemplate_Increment.DestinationStudentSchema" xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp">
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/s0:Students" />
    </xsl:template>
    <xsl:template match="/s0:Students">
    <ns0:DestinationDetails>
    <xsl:for-each select="StudentTransactions">
    <xsl:if test="FName='H'">
    <xsl:variable name="var:v104" select="ID"/>
    <xsl:variable name="count" select="0"/>
    <xsl:for-each select="/s0:Students/StudentTransactions[FName='D' and ID_Detail=$var:v104]">
    <xsl:variable name="Detail_String" select="string(GL_String/text())"/>
    <!--<xsl:if test="$Detail_String!='' and $count=0">-->
    <xsl:if test="position() =1 and $Detail_String!=''" >
    <xsl:variable name="var:v1" select="userCSharp:StringConcat(string(FName/text()) , string(LName/text()))" />
    <Details>
    <ID>
    <xsl:value-of select="ID/text()" />
    </ID>
    <FullName>
    <xsl:value-of select="$var:v1" />
    </FullName>
    <Cost>
    <xsl:value-of select="Cost/text()" />
    </Cost>
    </Details>
    <!--<xsl:value-of select="$count + 1"/>-->
    </xsl:if>
    </xsl:for-each>
    </xsl:if>
    </xsl:for-each>
    </ns0:DestinationDetails>
    </xsl:template>
    <msxsl:script language="C#" implements-prefix="userCSharp">
    <![CDATA[
    public string StringConcat(string param0, string param1)
    return param0 + param1;
    ]]>
    </msxsl:script>
    </xsl:stylesheet>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Create multiple line item from one line item in BizTalk mapping

    Hi,
    In one of our new requirement we need to create 3 line items for every line item we are receiving with same value but in the below format.
    Sample Input:
    <EmpId>1234</EmpId><Name>ABCD></Name><Dept>YYY</Dept><Year>2014</Year><Desc1>D1</Desc1><Desc2>D2</Desc2><Desc3>D3</Desc3><Valid>Yes</Valid>
    Sample Output in Flatfile:
    1234,ABCD,,,D1,Yes
    1234,ABCD,YYY,,D2,Yes
    1234,ABCD,YYY,2014,D3,Yes
    Can you Pls help me in creating the mapping in above format.
    Thanks in advance,
    Regards,
    Elango
    Chennai.
    Mark As Answer or Vote As Helpful if My Reply Does.

    Elango,
    Before I explain about the solution, make sure when you give inputs/requirement in forums for us to help you, pay attention.
    The input instance you have shown
    Doesn’t have a root element
    Has a typo - <Name>ABCD></Name> -Element has invalid “>” character.
    This makes us to spend more time in cleansing your input and then find out solution.
    We are here to help you, so help us to help you better.
    Anyway, coming to the solution
    You have to create map with a structure similar to the below shown image:
    Here destination schema is a flat file schema with comma-delimited fields.
    If you look into the destination schema, it look similar to your input schema, but there is just one “Desc” field instead of “Desc1”, “Desc2”, “Desc3” in your source schema. In destination, the
    record has to repeat with same values for rest of the fields. And for “Desc” in destination schema will have corresponding index value of “Desc1” or “Desc2” or “Desc3” from source. i.e. first node of destination will have value of “Desc1” from source to “Desc”
    field in destination, second node of destination will have value of “Desc2” from source to “Desc” field in destination and third node of destination will have value of “Desc3” from source to “Desc” field in destination.
    I use XSLT in the map, with recursive template which will repeat for 3 times. I have given comment in the XSLT for your benefit.
    <?xml version="1.0" encoding="UTF-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0">
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/Root" />
    </xsl:template>
    <xsl:template match="/Root">
    <Record>
    <!--Call the template with index and counter of 3. There times as you wanted for every item-->
    <xsl:call-template name="LintItemTemp">
    <xsl:with-param name="i">1</xsl:with-param>
    <xsl:with-param name="count">3</xsl:with-param>
    </xsl:call-template>
    </Record>
    </xsl:template>
    <xsl:template name="LintItemTemp">
    <xsl:param name="i" />
    <xsl:param name="count" />
    <Details>
    <EmpId>
    <xsl:value-of select="EmpId/text()" />
    </EmpId>
    <Name>
    <xsl:value-of select="Name/text()" />
    </Name>
    <Dept>
    <xsl:value-of select="Dept/text()" />
    </Dept>
    <Year>
    <xsl:value-of select="Year/text()" />
    </Year>
    <!--as in your output instance, Lineitem1 will have value of Desc1-->
    <xsl:if test ="($i =1)">
    <Desc>
    <xsl:value-of select="Desc1/text()" />
    </Desc>
    </xsl:if>
    <!--as in your output instance, Lineitem2 will have value of Desc3-->
    <xsl:if test ="($i =2)">
    <Desc>
    <xsl:value-of select="Desc2/text()" />
    </Desc>
    </xsl:if>
    <!--as in your output instance, Lineitem3 will have value of Desc3-->
    <xsl:if test ="($i =3)">
    <Desc>
    <xsl:value-of select="Desc3/text()" />
    </Desc>
    </xsl:if>
    <Valid>
    <xsl:value-of select="Valid/text()" />
    </Valid>
    <xsl:value-of select="./text()" />
    </Details>
    <!--Recursive template, i.e. calling the template again for 3 times as your requirement-->
    <xsl:if test="$i &lt; $count">
    <xsl:call-template name="LintItemTemp">
    <xsl:with-param name="i">
    <xsl:value-of select="$i + 1"/>
    </xsl:with-param>
    <xsl:with-param name="count">
    <xsl:value-of select="$count"/>
    </xsl:with-param>
    </xsl:call-template>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    So the input and output will look like the below:
    You can change the schema/XSLT and its corresponding namespaces as you want.
    When the above shown output is send to a custom-pipeline with flat file assembler in send port will output the above shown output to the flat-file structure as you wanted. Again, I repeat you
    to use flat-file file schema with comma-delimited fields as the destination schema in the above shown map for you to get the flat-file output as you needed.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Using Custom XSLT File for html output file

    Hi all
    I have probably rather a silly question but I have not found a solution yet.
    I would like to use a custom XSLT file, which I already have and is working, within a Biztalk Map. The custom XSLT is generating a html file out of an xml file. However I'm not able to succeed so far because I have probably some issues in defining the correct
    target schema. 
    The output that I get at the moment is just a duplicate of the input, probably because I have used the schema for source and target.
    So my question is, how do I create a html file out of an xml with a custom XSLT file?
    Sorry if this is a nooby question but I couldn't find an answer.

    Hi Jerome,
    Sorry, your question is not very clear. "I would like to use a custom XSLT file, which I already have and is working, within a BizTalk Map. The custom XSLT is generating a html file out of an xml file" -  You have an XSLT which you use for map and how
    its generating a HTML file? Are you using something like this?
    Changing an XML Response to an HTML output using a Map
    If your requirement is to output the html file from the received XML file using XSLT, then use a custom pipeline at send port like XSLT Transform Component and provide the XST which would change the XML to HTML. Here is an example of an XST which I have
    used in the past, which converts the received OrderResponse XML to nicely formatted HTML.
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://biztalk.orderapp.schemas.OrderResponse">
    <xsl:template match="/">
    <html>
    <body>
    <TABLE BORDER="0" cellspacing="2" cellpadding="2" width="90%">
    <xsl:apply-templates select="/ns0:OrderResponse"/>
    </TABLE>
    </body>
    </html>
    </xsl:template>
    <xsl:template match="/ns0:OrderResponse">
    <TR>
    <TD colspan="8" align="center">
    <H1>Order Confirmation</H1>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Order no : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:OrderHeader/ns0:OrderNumber/text()"/>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Supplier : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:SupplierDetails/ns0:SupplierName/text()"/>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Supplier Order no : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:SupplierDetails/ns0:SupplierOrderNumber/text()"/>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Account no : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:OrderHeader/ns0:CustomerAccountNumber/text()"/>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Order date : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:OrderHeader/ns0:OriginalOrderCreationDate/text()"/>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Delivery date : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:OrderHeader/ns0:DeliveryDate/text()"/>
    </TD>
    </TR>
    <TR>
    <TD colspan="2">
    <B>Order Status : </B>
    </TD>
    <TD colspan="6" align="left">
    <xsl:value-of select="ns0:OrderHeader/ns0:OrderStatus/text()"/>
    </TD>
    </TR>
    <TR>
    <TD colspan="8">
    <BR></BR>
    </TD>
    </TR>
    <TR>
    <TD valign="top">
    <B>Line</B>
    </TD>
    <TD valign="top">
    <B>Code</B>
    </TD>
    <TD valign="top">
    <B>UOM</B>
    </TD>
    <TD valign="top">
    <B>
    Avail<BR></BR>Qty
    </B>
    </TD>
    <TD valign="top">
    <B>
    Line<BR></BR>Price
    </B>
    </TD>
    <TD valign="top">
    <B>
    Line<BR></BR>Status
    </B>
    </TD>
    </TR>
    <xsl:for-each select="ns0:LineItems">
    <xsl:for-each select="ns0:LineItem">
    <TR>
    <TD valign="top">
    <xsl:value-of select="ns0:LineNumber/text()"/>
    </TD>
    <TD valign="top">
    <xsl:value-of select="ns0:ProductCode/text()"/>
    </TD>
    <TD valign="top">
    <xsl:value-of select="ns0:UnitOfMeasure/text()"/>
    </TD>
    <TD valign="top">
    <xsl:value-of select="ns0:Quantity/text()"/>
    </TD>
    <TD valign="top">
    <xsl:value-of select="ns0:UnitPrice/text()" />
    </TD>
    <TD valign="top">
    <xsl:value-of select="ns0:LineStatus/text()" />
    </TD>
    </TR>
    </xsl:for-each>
    </xsl:for-each>
    <TR>
    <TD colspan="8">
    <BR></BR>
    </TD>
    </TR>
    </xsl:template>
    </xsl:stylesheet>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Biztalk Map: Accumulation of unique detail elements in the header

    Below are the source and target schemas. I was wondering how I can achieve a mapping where the element "country" in the detail are promoted to the header where the list contains only unique country names with quantity defaulted to 1. In the example
    below, from each of the subcategories, the countries are picked up and only unique ones appear in the output's header.
    <Category CatId=1 CatName=Bikes Function=Travel>
    <SubCat SubCatId=1 SubCatName=Avon>
    <Countries>
    <Country Name="Canada" Quantity=20 />
    <Country Name="USA" Quantity=22 />
    <Country Name="NZ" Quantity=30 />
    </Countries>
    </SubCat>
    <SubCat SubCatId=2 SubCatName=Hero>
    <Countries>
    <Country Name="Canada" Quantity=20 />
    <Country Name="Mexico" Quantity=5 />
    <Countries>
    </SubCat>
    <SubCat SubCatId=3 SubCatName=Jet>
    <Countries>
    <Country Name="UK" Quantity=15 />
    <Country Name="USA" Quantity=5 />
    <Country Name="Germany" Quantity=2 />
    <Countries>
    </SubCat>
    </Category>
    <Category CatId=1 CatName=Bikes Function=Travel>
    <Countries>
    <Country Name="Canada" Quantity=1 />
    <Country Name="USA" Quantity=1 />
    <Country Name="NZ" Quantity=1 />
    <Country Name="Mexico" Quantity=1 />
    <Country Name="UK" Quantity=1 />
    <Country Name="Germany" Quantity=1 />
    </Countries>
    <SubCat SubCatId=1 SubCatName=Avon>
    <Countries>
    <Country Name="Canada" Quantity=20 />
    <Country Name="USA" Quantity=22 />
    <Country Name="NZ" Quantity=30 />
    </Countries>
    </SubCat>
    <SubCat SubCatId=2 SubCatName=Hero>
    <Countries>
    <Country Name="Canada" Quantity=20 />
    <Country Name="Mexico" Quantity=5 />
    <Countries>
    </SubCat>
    <SubCat SubCatId=3 SubCatName=Jet>
    <Countries>
    <Country Name="UK" Quantity=15 />
    <Country Name="USA" Quantity=5 />
    <Country Name="Germany" Quantity=2 />
    <Countries>
    </SubCat>
    </Category>

    ZIntegrator,
    You can try following custom xslt
    <?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">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
    <xsl:key name="country" match="//Country/@Name" use="." />
    <xsl:template match="/">
    <xsl:element name="Category">
    <xsl:copy-of select="//Category/@*" />
    <xsl:apply-templates select="Category" />
    <xsl:apply-templates select="//SubCat" mode="CopyRest" />
    </xsl:element>
    </xsl:template>
    <xsl:template match="Category">
    <xsl:for-each select="SubCat/Countries/Country/@Name[generate-id()= generate-id(key('country',.)[1])]">
    <xsl:element name="Country">
    <xsl:value-of select="."/>
    </xsl:element>
    </xsl:for-each>
    </xsl:template>
    <xsl:template match="@* | node()" mode="CopyRest">
    <xsl:copy>
    <xsl:apply-templates select="@* | node()" mode="CopyRest"/>
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

  • Biztalk Map Logic

    Hi,
    I have the Biztalk Map logic as shown in figure
    Discount Step and Loyalty both are repeatitive node structures
    Sample Input Xml is as shown below
    <DiscountStepList>
     <DiscountStep>
      <NumberOfTrips>35</NumberOfTrips>
      <Percentage>1113</Percentage>
      </DiscountStep>
     <DiscountStep>
      <NumberOfTrips>5</NumberOfTrips>
      <Percentage>7732</Percentage>
      </DiscountStep>
     <DiscountStep>
      <NumberOfTrips>30</NumberOfTrips>
      <Percentage>8280</Percentage>
      </DiscountStep>
       </DiscountStepList>
    the logic to get the o/p will be
    For Childe Element MIntrip:
    in the first iteration Mintrip=1 and in Secoond iteration Mintrip=Last elememnt Maxtrips+1
    For CHild Element Maxtrips:
    In the first Iteration Maxtrips="NumberOfTrips" and in Second iteration current element MintripNum  + NumberOfTrips.
    The o/p for the above input example will be like
    <ns0:Loyalites xmlns:ns0="http://BizTalk_Server_Project7.Schemdfa1">
      <Loaylty>
        <MinTrip>1</MinTrip>
        <MaxTrips>35</MaxTrips>
      </Loaylty>
    <Loaylty>
        <MinTrip>36</MinTrip>
        <MaxTrips>41(36+5)</MaxTrips>
      </Loaylty>
    <Loaylty>
        <MinTrip>36</MinTrip>
        <MaxTrips>41(36+5)</MaxTrips>
      </Loaylty>
    <Loaylty>
        <MinTrip>42</MinTrip>
        <MaxTrips>72(42+30)</MaxTrips>
      </Loaylty>
    </ns0:Loyalites>
    Is it possible in Biztalk Map using functoids?

    Sujith,
    You got to buy me a drink :)
    You can achive this using XSLT in your map, following XSLT will get the desired result:
    <?xml version="1.0" encoding="UTF-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" xmlns:ns0="http://BizTalk_Server_Project7.Schemdfa1" >
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/DiscountStepList" />
    </xsl:template>
    <xsl:template match="/DiscountStepList">
    <ns0:Loyalites>
    <xsl:for-each select="DiscountStep">
    <xsl:if test="position() =1">
    <Loaylty>
    <MinTrip>
    <xsl:value-of select="position()" />
    </MinTrip>
    <MaxTrips>
    <xsl:value-of select="NumberOfTrips/text()" />
    </MaxTrips>
    </Loaylty>
    <xsl:call-template name="ConstructNextLoayltyNode">
    <xsl:with-param name="i" select="2"/>
    <xsl:with-param name="limit" select="count(/DiscountStepList/DiscountStep)"/>
    <xsl:with-param name="vMaxTrips" select="NumberOfTrips/text()"/>
    </xsl:call-template>
    </xsl:if>
    </xsl:for-each>
    </ns0:Loyalites>
    </xsl:template>
    <xsl:template name="ConstructNextLoayltyNode">
    <xsl:param name="i"/>
    <xsl:param name="limit"/>
    <xsl:param name="vMaxTrips"/>
    <xsl:if test="$i &lt;= $limit">
    <Loaylty>
    <MinTrip>
    <xsl:value-of select="$vMaxTrips + 1" />
    </MinTrip>
    <MaxTrips>
    <xsl:value-of select="$vMaxTrips + 1 +/DiscountStepList/DiscountStep[$i]/NumberOfTrips/text() " />
    </MaxTrips>
    </Loaylty>
    <xsl:call-template name="ConstructNextLoayltyNode">
    <xsl:with-param name="i" select="$i+1"/>
    <xsl:with-param name="limit" select="$limit"/>
    <xsl:with-param name="vMaxTrips" select="$vMaxTrips + 1 +/DiscountStepList/DiscountStep[$i]/NumberOfTrips/text()"/>
    </xsl:call-template>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    Note: You may have to change the namespace as yours. And also the output sample you have show has repeated node as following which is correct.
    <Loaylty>
        <MinTrip>36</MinTrip>
        <MaxTrips>41(36+5)</MaxTrips>
      </Loaylty>
    <Loaylty>
        <MinTrip>36</MinTrip>
        <MaxTrips>41(36+5)</MaxTrips>
      </Loaylty>
    For your requirement you will get the out as following which your requirement:
    <ns0:Loyalites xmlns:ns0="http://BizTalk_Server_Project7.Schemdfa1">
    <Loaylty>
    <MinTrip>1</MinTrip>
    <MaxTrips>35</MaxTrips>
    </Loaylty>
    <Loaylty>
    <MinTrip>36</MinTrip>
    <MaxTrips>41</MaxTrips>
    </Loaylty>
    <Loaylty>
    <MinTrip>42</MinTrip>
    <MaxTrips>72</MaxTrips>
    </Loaylty>
    </ns0:Loyalites>
    Regards,
    M.R.Ashwin Prabhu
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • XPath Error after using custom xslt

    I made a mapping between my input schema and destination schema through custom xslt.
     After constructing the message when I fetch the destination schema element value through xpath it does not contains
    any value but when I saved that destination message in a location then I got all the elements value.
    When I want to update the value of any element then it shows the following error :
    The XPath expression: ' xpath of element '
    selected a node which is not valid for property or distinguished field retrieval, or it selected no node at all. Only text-only elements or attributes may be selected.
    The xpath is correct.
    Why this is occuring ?
    While I am not using any custom xslt, it is working fine.
    Any kind of help would be appreciated.
    Prakash

    Look like you're trying to use a XPath for an element/node which doesn't exist in the received message.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How to use the bind variable in custom.pll

    Hi,
    How to use the bind variable in custom.pll.Its through error.
    any one gem me.
    very urgent.
    M.Soundrapandian.

    Hello,
    Please, ask this kind of questions in the e-business forum.
    Francois

Maybe you are looking for

  • Making a form where attachments must be included

    Hi I need to make a fillable form where when the person is done they must attach certain files before they can submit the form. I would like a checklist where they tick the box, example Certified ID and they can browse to the file on their computer a

  • Fetchmail (or something similar) on Mac OS X Server

    I would like to have Mac OS X Server 10.4.7 (with its standard Mail Services) fetch emails from remote POP3 accounts and put them into users' local email accounts on my server (from where they will be accessed through IMAP), basically like what fetch

  • Dual ultra320 scsi controller

    Hi all I m trying to install new dual ultra320 scsi controller on Sun Fire c20z Server. But there is an error message ERROR: EXPANSION ROM NOT INITALIZED PCI MASS STORAGE CONTROLLER IN SLOT 02 BUS 03 DEVICE 01 FUNCTION 0.0 Pls help me to fix this Pro

  • Can't Find Music Files in C Drive

    There are many AAC files that I can see in iTune library, but I can't find those in 'My Document/My Music' folder, nor can I find those in my local hard drive. Where could these file be?

  • Photoshop CS5 quits when asked to print an "user defined page"

    I own an iMac desktop and after updating to Yosemite, when trying to print with PS CS5 and image with "user defined" sizes,in my HP Officejet 6000, PS freezes and quits abruptly.  Erstwhile I used to do this w/o any problem.   Any ideas?  Thank you!