BizTalk Map - Xslt Issue

Hi,
Here is a piece of xslt, i need to replace the characters with their shortcode which are not supported in xml.
For eg i need to replace '&' to '&amp' and similarly all other characters as mentioned
Unsupported characters and their replacements:
& - &
< - &lt;
> - &gt;
" - &quot;
' - &#39;
XSLT:
<xsl:if test="/*[local-name()='Root' and namespace-uri()='http://schemas.microsoft.com/BizTalk/2003/aggschema']/*[local-name()='InputMessagePart_1' and namespace-uri()='']/*[local-name()='GetOrderDetailsByIdResponse' and namespace-uri()='http://tempuri.org/']/*[local-name()='GetOrderDetailsByIdResult'
and namespace-uri()='http://tempuri.org/']/*[local-name()='TermsAndConditionList' and namespace-uri()='http://schemas.datacontract.org/2004/07/GEP.Cumulus.P2P.BusinessEntities']/*[local-name()='TermsAndCondition' and namespace-uri()='http://schemas.datacontract.org/2004/07/Gep.Cumulus.CSM.Entities']/*[local-name()='TermsConditionText'
and namespace-uri()='http://schemas.datacontract.org/2004/07/Gep.Cumulus.CSM.Entities']/text()">
<Extrinsic>
<HeaderExtrinsic>
<TermsAndConditions>
<xsl:for-each select="../s10:TermsAndConditionList">
<xsl:for-each select="s9:TermsAndCondition">
<xsl:if test="s9:TermsConditionText">
<TermsAndCondition>
<xsl:value-of select="s9:TermsConditionText/text()" /> 
</TermsAndCondition>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</TermsAndConditions>
</HeaderExtrinsic>
</Extrinsic>
</xsl:if>
[Need to do it in the value coming from termandcondition text ie s9:TermsConditionText]
Thanks in Advance

Then go back to the source and explain to them that this is not valid XML, and you cannot consume it. Have you tried opening this XML in a web browser? or have an XML Disassemble Pipeline Component consume it?
It should be 
<ns5:TermsConditionText>Terms&amp;conditions</ns5:TermsConditionText>
From the source, otherwise you will not be able to parse it as XML.
Morten la Cour

Similar Messages

  • 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.

  • Invoice PO issue in BizTalk Map

    Hi All,
    I did get below error while I was testing the map. I have reloading the map so many times still I'm getting below error
    Invoking component...
    C:\somepath.btm: error btm1023: Exception Caught: The map contains a reference to a schema node that is not valid.  Perhaps the schema has changed.  Try reloading the map in the BizTalk Mapper.  The XSD XPath of the node is: /*[local-name()='<Schema>']/*[local-name()='']/*[local-name()='']/*[local-name()='INVOICE']/*[local-name()='POSITEID']
    Component invocation succeeded.
    How can i fix this error could you please assist me on this.
    Thanks & Regards,
    Vasu

    Hi Vasu,
    1) Try "CLEAN SOLUTION" and then try,
    2) If that doesnt fix. Choose the properties of the map and disable the “Ignore Namespaces for Links” like this:
    Refer: Two nodes on same
    level with same name but different namespace
    3) If that doesn't fix the issue, Refer this link. FIX:
    Error message when you validate a BizTalk map in BizTalk Server 2006 R2 or in BizTalk Server 2009 if the map and its schemas are in a separate project
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • 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.

  • Create null message using BizTalk mapper XSLT

    Hi,
    I have a requirement to check if a message contains a certian value, and if so, throw away the message.  Does anyone know how this could be done using BizTalk mapper/ XSLT?  It's an ESB messaging only solution so don;t want to introduce orchestratons
    / c# code.
    In short is field A = 'yes' the message will be thrown away / made null. 
    Thanks in advance.
    GilesB

    If you consider doing this in Receive-side with some pipeline component, I am afraid you can't eat the data at the receive pipeline. For a null returned, I believe at least a empty message would be published to message box.
    Without orchestration, in message-only scenario one option you can consider is using a custom adapter where you can have your logic whether to send a stream/message out or not. Something like:
    public bool TransmitMessage(IBaseMessage msg)
    _terminate.Enter();
    try
    bool logMessages = Convert.ToBoolean(
    GetAdapterConfigValue(msg.Context, "logMessages")
    if ( logMessages ) {
    SystemMessageContext ctxt = new SystemMessageContext(msg.Context);
    //Add your logic using XPathReader - stream based XPath
    //and check whether the message has the value your're looking for
    bool isFound = false;
    if (!isFound)
    string msgData = "";
    StreamReader reader = new StreamReader(msg.BodyPart.Data);
    using (reader)
    msgData = reader.ReadToEnd();
    // discard the message
    return true;
    } finally {
    _terminate.Leave();
    Above is part of the send adapter code where you add your logic using XPathReader - stream based XPath and check whether the message has the value your're looking for. You can use
    null send adapter as refernce and build your logic where it would check for the required value in your custom adapter.
    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 Julian date

    Hi,
    how can i convert date into julian date in BT map. 
    Thanks in adv.
    2Venture2

    Try this in BizTalk map via an inline C# scripting functoid
    public static string ToJulian(string strdateTime)
    DateTime dateTime = Convert.ToDateTime(strdateTime);
    int day = dateTime.Day;
    int month = dateTime.Month;
    int year = dateTime.Year;
    if (month < 3)
    month = month + 12;
    year = year - 1;
    long dt = day + (153 * month - 457) / 5 + 365 * year + (year / 4) - (year / 100) + (year / 400) + 1721119;
    return dt.ToSTring(dt);
    or this returns long, and the input parameter is datetime
    public static long ToJulian(DateTime dateTime)
    int day = dateTime.Day;
    int month = dateTime.Month;
    int year = dateTime.Year;
    if (month < 3)
    month = month + 12;
    year = year - 1;
    return day + (153 * month - 457) / 5 + 365 * year + (year / 4) - (year / 100) + (year / 400) + 1721119;
    Refer this article for more details:http://mikearnett.wordpress.com/2011/09/13/c-convert-julian-date/
    Following in the what we have been using in our maps, this has two static methods. One for standard datetime to Julian and another to convert Short datetime to Julian:
    public int ToJulian(string dt)
    try
    DateTime date = DateTime.Parse(dt);
    return ((date.Year - 1900) * 1000) + date.DayOfYear;
    catch
    return 0;
    /// <summary>
    /// Convert to Julian from dd/mm/yy
    /// </summary>
    /// <param name="dt"></param>
    /// <returns></returns>
    public int ToJulianFromShortDT(string dt)
    try
    DateTime date = new DateTime(int.Parse(dt.Substring(6, 2))+2000, int.Parse(dt.Substring(3, 2)), int.Parse(dt.Substring(0, 2)));;
    return ((date.Year - 1900) * 1000) + date.DayOfYear;
    catch
    return 0;
    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: Repeated node

    Hi,
    Please find below Input file
    <Vin_Decoder>
    <Process>
    <Risk>
    <Line>
    <Exposer>
    <Type>VIN</type>
    <Svalue>123456789123456789</Svalue>
    </Exposer>
    <Exposer>
    <Type>Year</type>
    <Svalue>2014</Svalue>
    </Exposer>
    <Exposer>
    <Type>MAKE</type>
    <Svalue>2546</Svalue>
    </Exposer>
    <Exposer>
    <Type>Discripttion</type>
    <Svalue></Svalue>
    </Exposer>
    </line>
    </risk>
    <Risk>
    <Line>
    <Exposer>
    <Type>VIN</type>
    <Svalue>123456789987654321</Svalue>
    </Exposer>
    <Exposer>
    <Type>Year</type>
    <Svalue>2013</Svalue>
    </Exposer>
    <Exposer>
    <Type>MAKE</type>
    <Svalue>6789</Svalue>
    </Exposer>
    <Exposer>
    <Type>Discripttion</type>
    <Svalue>kfjdklf</Svalue>
    </Exposer>
    </line>
    </risk>
    </Process>
    </Vin_Decoder>
    and i am expecting the out put format
    <Vin_Decoder>
    <Decoder>
    <VIN>123456789123456789</VIN>
    <Year>2014</Year>
    <Make>2546</Make>
    <Description></Description>
    </Decoder>
    <Decoder>
    <VIN>123456789987654321</VIN>
    <Year>2013</Year>
    <Make>7896</Make>
    <Description>kfjdklf</Description>
    </Decoder>
    </Vin_Decoder>
    please suggest me how to do this in biztalk map..
    Thanks..

    Hi,
    In the Vin_Decoder schema create a "Decoder" Child Record and make it optional. Inside the Decoder" Record create the all the Field Elements like VIN, Year, etc. Create a map where the source and destination is the Vin_Decoder schema. Map to the field
    elements inside the Decoder" Record.
    Kind regards,
    Tomasso Groenendijk
    Blog 
    |  Twitter
    MCTS BizTalk Server 2006, 2010
    If this answers your question please mark it accordingly

  • What is Road map Analysis, Issue tracking,, Monitoring, Reporting?

    Hi
    Friends
    what is Road map Analysis, Issue tracking,, Monitoring, Reporting?
    can any one clear my doubts in detail full points will be given

    Dear Venkat,
    Your questions are very high level questions.
    Roadmap Analysis: This term is generally used in SAP Implementation where we compare the project status with the SAP roadmap. Generally in ASAP Roadmap, we have SAP specified standard deliverables, and there can be custom deliverables as per the client's requirements. If we need to do an analysis of custom deliverables viz standard deliverables or standard roadmap viz custom roadmap, we call it as roadmap analysis.
    Issue Tracking: Very broad level term - can be in Implementation as well as support projects. Issues are either support problems or implementation problems which are documented and recorded for solutioning and approval. These are generally steering committee terms used in a project.
    Monitoring: Again a broad level term. Any watch process can be termed as monitoring. Eg: Monitoring of Backup; Monitoring of System health check etc.
    Reporting: Again a broad level term. It is the same as defined in the english dictionary. Nothing related to any process in SAP with technical solution in mind.
    Regards,
    Anirban

  • 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

  • XSLT Issue : Without the target file mapping is happening

    Hi,
    In one of my composite, which is a provider abcs transforms source to target, where in the transformation file, source and target are mentioned as usual, both are pointing to MDS locations.
    Source file is physically present in the MDS, but the target file is not present but still the transformation happening.
    The flow is like below.
    ProviderABCS -> Adapter service which will write the file.
    Some time the file is created with data and some time only the file is created without data.
    My question is how come there is no exception caught ? If i keep the target schema or wsdl file in MDS will this issue get resolved ?
    Thanks,
    Vijay

    When i try to open the xslt file with designer view its complaining that the target file is missing, but when i deploy, iam able to deploy and run with some instances.
    Still investigating.. wll update you.. soon. In the mean time if any body have any other idea.. plz update the thread.
    Thanks,
    Vijay

  • 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.

  • 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.

  • Biztalk Map create duplicate target node

    Using biztalk mapper, I need a target node to be duplicated.. I have created a simplified version of my issue. Please see below map
    link for source and destination schema.
    I  need the target Option node to be duplicated for each OptionNotes. The value of OptionNotes is to be split by a pipe ("|"),
    then map to target Code and Description.
    The input is as below:
    <ns0:Source xmlns:ns0="http://Test.SOAP.Source1">
    <Option>
    <OptionID>ID0_NoNotes</OptionID>
    <OptionName>OptionName_0</OptionName>
    </Option>
    <Option>
    <OptionID>ID1_NoNotes</OptionID>
    <OptionName>OptionName_1</OptionName>
    <OptionNotes>NOTE1|BLAH1</OptionNotes>
    <OptionNotes>NOTE2|BLAH2</OptionNotes>
    </Option>
    </ns0:Source>
    The output should be as below:
    <Destination>
    <Options>
    <Option>
    <Code>ID0_NoNotes</Code>
    <Description>OptionName_0</Description>
    </Option>
    <Option>
    <Code>ID1_NoNotes</Code>
    <Description>OptionName_1</Description>
    </Option>
    <Option>
    <Code>NOTE1</Code>
    <Description>BLAH1</Description>
    </Option>
    <Option>
    <Code>NOTE2</Code>
    <Description>BLAH2</Description>
    </Option>
    </Options>
    </Destination>
    Tried to use Looping and combination with Value Mapping, but to no avail. Do I have to resort to inline xslt?
    Thanks.

    Thanks for all your answers.
    @Pi_xel_xar Your suggestion requires a change in the message schema.
    @Nadeem We have already tried the solution on the blog, but it's not quite the scenario we face. The issue is the OptionNote is in the same layer as OptionID and OptionName.
    We have used another tool, which has done this easily. We then get the XSLT and import it as part of Inline XSLT scripting functoid.
    The XSLT produced was as below:
    <xsl:for-each select="ns0:Source/Option">
    <Option>
    <xsl:for-each select="OptionID">
    <Code>
    <xsl:value-of select="string(.)"/>
    </Code>
    </xsl:for-each>
    <xsl:for-each select="OptionName">
    <Description>
    <xsl:value-of select="string(.)"/>
    </Description>
    </xsl:for-each>
    </Option>
    </xsl:for-each>
    <xsl:for-each select="ns0:Source/Option/OptionNotes">
    <xsl:variable name="var1_resultof_cast" select="string(.)"/>
    <Option>
    <Code>
    <xsl:value-of select="substring-before($var1_resultof_cast, '|')"/>
    </Code>
    <Description>
    <xsl:value-of select="substring-after($var1_resultof_cast, '|')"/>
    </Description>
    </Option>
    </xsl:for-each>
    Thanks everyone.

  • 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.

  • XSLT issue: copy-of

    Hi friends,
    I'm now having an issue when using copy-of in XSLT:
    I have a top node called PutXMLDocument, a second level node XMLString, and 3 level nodes in my xml. With a XSLT mapping, I'd like to move all contents of 3 level nodes into 2nd level node "XMLString". I know I should use copy-of command, but what select statement I shall use for this problem?
    Or more simply: What's the XPATH expression for all descendant nodes of current node?
    Any hints is highly appreciated.
    Thanks
    Luis

    Hi,
    <xsl:copy-of>Creates a copy of the current node (with child nodes and attributes)
    Check this eg-
    http://www.w3schools.com/xsl/el_copy-of.asp
    Regards,
    Moorthy

Maybe you are looking for

  • Lumia 800 Wifi crashes

    I have the Lumia 800 purchased from Phonehouse, France with Orange as the provider.   My Wifi seem to crash (gets automatically turned off) after 4-5 hours. If I then goto Settings - Wifi, it becomes unresponsive and shows a black screen. I have to r

  • How come my iphoto keeps quitting unexpectedly?

    why isnt my iphoto working? i really need it too work, but it keeps quitting unexpectedly.

  • Can I order iPhoto prints from Malta?

    The options menu on iPhoto lets you select a print products store based on your shipping address.  Does this mean iPhoto prints are restricted to certain countries only, and will this feature be available in more countries in future?   Can I print co

  • IPhone playing up

    The last advice I got on here was to do a clean install of iOS 4.2 but it has made no difference, battery life is poor, worse than my 2 year old 3g, music will randomly skip and yesterday just to finally annoy me I was listening to an audio book thro

  • Currently OS X10.5.8 - interested in upgrading to Lion

    I am currently on 10.5.8, what do i need to do to install new os x lion? on the prompt, it only says 10.6.8 are eligible to purchase and upgrade the new os x. does this mean i need to upgrade to snow leopard first?