Mapping of elements from 2 different Namespaces.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luthriaajay
    New Member
    • Apr 2007
    • 56

    Mapping of elements from 2 different Namespaces.

    I have a query regarding mapping of 2 different namespace elements :

    1).I get the undermentioned XML data from a system:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4">
    	<Order Acct="1" ExDest="ExchDest">
    		<Hdr Snt="2007-04-05T13:34:47"/>
    		<Instrmt Issr="Barclays" MMY="200903"/>
    	</Order>
    </FIXML>

    2).The above XML element values need to be extracted and put in the format that we are
    using below with the prefix i:

    Code:
    <i:Interest xsi:schemaLocation="http://www.abc.com/interests:i 
                                    http://ABC/derivatives/interests/interests.xsd" 
                                    xsi:type="i:vanilla" 
                                    xmlns:i="http://www.abc.com/interests:i" 
                                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                                    xmlns:strategies="http://www.abc.com/derivatives/strategies">
    <i:ID>249403</i:ID>
    <i:Status>0</i:Status>
    <i:Generation>2</i:Generation>
    <i:Entered Formatted="" Format="dd mmm yyyy hh:mm:ss">2007-04-02T18:34:43</i:Entered>
    	<i:Updated Formatted="" Format="dd mmm yyyy hh:mm:ss">2007-04-02T18:36:47</i:Updated>
    <i:Description>EQ.D</i:Description>
      .........
    Now,my query is:

    1) Do I need any mapping mechanism to read data from the XML defined in (1) in the format defined in (2).
    If so,please can you suggest a way for this?

    2) OR is it a wise idea to hardcode the elements with the prefix of 'i:' in my style sheet as below :

    Code:
        <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
         xmlns:fo="http://www.w3.org/1999/XSL/Format" 
         xmlns:fix="http://www.fixprotocol.org/FIXML-4-4"  
         xmlns:i="http://www.abc,com/common/interests:i"
         exclude-result-prefixes="fo i ">
    
    <xsl:template match="fix:FIXML">
       <xsl:apply-templates select="fix:Order"/>
    </xsl:template>
    
    <xsl:template match="fix:Order">
    
    <OrderCancelRequest>
    <i:ID>
    <xsl:value-of select="@Acct"/>
    </i:ID>
    </OrderCancelRequest>
    Please suggest a way for this ? Help appreciated.
  • luthriaajay
    New Member
    • Apr 2007
    • 56

    #2
    Please ignore this question.
    Thanks,

    Comment

    • dorinbogdan
      Recognized Expert Contributor
      • Feb 2007
      • 839

      #3
      Hi,

      Is the question more needed?
      If not I will remove it.

      Thanks,
      Dorin.

      Comment

      • luthriaajay
        New Member
        • Apr 2007
        • 56

        #4
        Yes Dorin,you can delete this query.
        Thanks,
        Ajay

        Comment

        Working...