Using XSL-XML template to convert name value pairs into XML elements

Hi,
I have a xml document in the format:
<?xml version=”1.0”?>
<body title="Mr" firstName="Joesph" middeNames="George Harry" lastname="Smith" countrycode="GBP"/>
I need to convert this using a XSL-XML template in BI publisher to return XML in the following format, while doing some conversion, e.g. converting countrycode from GBP to UK:
<?xml version=”1.0”?>
<body>
<title>Mr</title>
<firstName>Joseph</firstName>
<middleNames>George Harry</middleNames>
<lastname>Smith</lastname>
<countrycode>UK</countrycode>
</body>
Would appreciate if anyone could point me in the correct direction.

Hi Sweta,
Why MTB??? Message Transformation bean is used to change the format of the message... If you are planning to call any XSLT or java mapping through that then you can give it a try..
>>how to get the last and first 3 special characters in the output text using MTB?
Put them in message mapping itself and write it in File
Regards
Suraj

Similar Messages

  • Converting Name-Value pair to XML

    Hi,
    I have configured the proxy service to listen for "&" delimited HTTP post string. I have been able to tokenize the "&" delimited string and get the name-value pair as below:
    ============================================================
    <CUSTOMER>
    <param name="amp;STATE_NAME" value="abc_test" />
    <param name="amp;EMAIL_ADDRESS" value="[email protected]" />
    </CUSTOMER>
    =====================================================
    Now I want to convert this name-value pair into XML format to comply with the xml schema. Kindly suggest the way how can this be achieved?

    Hi Hisaak,
    Thanks for the pointer But I am not able to access the Name-Value pair to form the desired XML.
    The output of first action is below and assigned to "payload" variable.
    ================================================
    <query-params>
    <param name="Model1" value="model1_test"/>
    <param name="Option1" value="option1_test"/>
    <param name="Quantity1" value="quantity1_test"/>
    </query-params>
    =================================================
    In second assign action , I have used your given code and assigned to "Order" variable.
    =====================================================
    <Order>
    <Model1>{$payload//param[@name = Model1]/@value}</Model1>
    <Options1>{$payload//param[@name = Options1]/@value}</Options1>
    <Quantity1>{$payload//param[@name = Quantity1]/@value}</Quantity1>
    <Model2>{$payload//param[@name = Model2]/@value}</Model2>
    </Order>
    =====================================================
    But after testing , I got the following output:
    ================================
    <Order>
    <Model1/>
    <Options1/>
    <Quantity1/>
    <Model2/>
    </Order>
    ====================================
    The values didn't update. Let me know if I am missing anything.

  • Translating a String (name value pair) to XML

    Hi Guys,
    I am trying to find an elegant way of translating a string containing name value pairs to XML within BPEL. The string looks as following:
    name=Bob
    dob = 28/09/1993
    This string has to be transformed to XML. Any of the two cases:
    either
    <root>
         <name>Bob</name>
         <dob>28/09/1993</dob>
    </root>
    or
    <root>
         <entry>
              <key>name</name>
              <value>BOB</value>
         </entry>
         <entry>
              <key>dob</name>
              <value>28/09/1993</value>
         </entry>
    </root>
    I am thinking of using embedded java for translation, but if there is any XPath function that can be used for that would be great. There is doTranslateFromNative but documentation is not descriptive enough and did not find anything on the web either.
    Thanks!

    Hi,
    Use substring-before(line,'=') and substring-after(line,'=') on each line in the string in an assign activity. Separate lines also with substring-before using a newline.
    Hope that helps.

  • Convert name value pair to flat structure in Biztalk mapper

    Hi,
    I have an input xml file with name value pairs and have to access all the values in the same iteration to concatenate fname and lname and assign that to a fullname in the target schema.
    I am trying with logical eq functoid and value mapping flattening but i can't access both the fname and lname at the same time.
    Does any one have an idea on how to get this done?
    My input file is
    <?xml version="1.0" encoding="UTF-8"?>
    <InputData dateFormat="yyyyMMdd">
    <CharacteristicList>
        <characteristic>
          <name>fname</name>
          <value>hello</value>
        </characteristic>
        <characteristic>
          <name>lname</name>
          <value>world</value>
        </characteristic>
    </CharacteristicList>
    </InputData>
    And the output file is 
    <ns0:Root xmlns:ns0="http://test.Transforms.Schema1">
      <Test >
        <Fullname>Hello World</Fullname>
      </Test>
    </ns0:Root>
    Thanks
    Janardhan Reddy Bikka

    Hi Janardhan,
    All you need is Cumulative Concatenate functiod with logical & value mapping functiod as shown:
    Add a Logical-Equal functiod. Link name element as its first parameter. And add “fname” as second parameter.
    Add another Logical-Equal functiod. Link name element as its first parameter. And add “lname” as second parameter.
    Add a Logical-Or functiod. Link the Logical-Equal functiod from fname as its first parameter. And Link the Logical-Equal functiod from lname as its second parameter
    Add value mapping (not the flattening one) functiod and link Logical-Or functiod.
    Add Cumulative Concatenate functiod. Link value mapping functiod to Cumulative Concatenate functiod as its first parameter. And add “1” as the second parameter. This second parameter provides the scope.
    Connect Cumulative Concatenate functiod to the fullname parameter.
    Add a looping functiod and connect parent CharacteristicList in source and Test in destination.
    With this map, if I use the input instance(XML) file as you have shown, I would get output as below:
    <ns0:Root xmlns:ns0="http://test.Transforms.Schema1">
    <Test>
    <Fullname>helloworld</Fullname>
    </Test>
    </ns0:Root>
    if I use following input with more than one Characteristlist
    <?xml version="1.0" encoding="UTF-8"?>
    <InputData dateFormat="yyyyMMdd">
    <CharacteristicList>
    <characteristic>
    <name>fname</name>
    <value>hello</value>
    </characteristic>
    <characteristic>
    <name>lname</name>
    <value>world</value>
    </characteristic>
    </CharacteristicList>
    <CharacteristicList>
    <characteristic>
    <name>fname</name>
    <value>Ashwin</value>
    </characteristic>
    <characteristic>
    <name>lname</name>
    <value>Prabhu</value>
    </characteristic>
    </CharacteristicList>
    </InputData>
    I will get output as below:
    <ns0:Root xmlns:ns0="http://test.Transforms.Schema1">
      <Test>
        <Fullname>helloworld</Fullname>
      </Test>
      <Test>
        <Fullname>AshwinPrabhu</Fullname>
      </Test>
    </ns0:Root>
    FYI: I have shown another sample instance with more first name and lastname because, you'r requirement is to have names concatenated with in a CharacteristicList
    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.

  • What technology to use to store a huge list of name-value pairs?

    Hi:
    I have a list of name value pairs (the size of the list is ~500). I get the name from the request parameter, and depending on the value for that, I have to display images on my webpage.
    How should I go about this? Should I use a Hashtable to store the values or should I use an array or should I got for XML and some pattern matching or should I write to a text file and do some pattern matching?
    Please help.
    Thanks

    Did you mean huge (several million) or is 500 more like the number? For "huge" you use a database. For 500, if you want to access the value when you are given the name, you use a Map. Probably a HashMap would be best.

  • I want to convert a pdf file into xml.Which programme should I use and how do I access it?

    I want to convert a pdf file into xml.Which programme should I use and how do I access it?I am based in India.

    Hello,
    if you create your doc files by the help of WORD, you could use a Microsoft add on (it depends of your WORD Version).
    Hans-Günter

  • Using JcomboBox name value pair

    Hi,
    I am designing a database system in Java using Swing for interfaces .. I have an issue with the ComboBox .. I was wondering if it is possible to have a name value pair for a combobox just like the html <select> tag .. becasue i am getting the data for the combobox from the database but I want it to display one column in the list and when chosen the value should be another field from the database.
    example: it should dispplay empFirstName .. nut when selected the value should be EmpID.
    Can someone hel me wtih this one ..
    thanks
    sandeep      

    You asked the same question in this thread:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=475554
    You were given answers and example code. If the answers and code are not what you need then you need to restate your question, to make your requirements clearer because you have been given the same answer three times.

  • XSLT Mapping to convert u201C.CSVu201D file into XML Structure.

    Hi All,
    I wanted to know can we use XSLT Mapping to convert u201C.CSVu201D file into XML Structure.
    I am communicating between two XI Systems. First XI system is going to give u201C.CSVu201D file as main document. I need to post IDOC Corresponding to this. So what I want to do is read this u201C.CSVu201D file (Main document in payload) and first convet it into XML and then use second mapping which will convert XML to IDOC.
    I know this is possible with JAVA Mapping but just wanted to confirm can we do this with XSLT mapping as well?
    Regards,
    Gouri

    Hi Amit,
    I know this way it shd work as i am able see other XSLT files. But this particular file is not visible.
    I am copying following code only in sample.xslt file.
    <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fn="fn"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      version="2.0" exclude-result-prefixes="xs fn">
    <xsl:output indent="yes" encoding="US-ASCII" />
    <xsl:param name="pathToCSV" select="'file:///c:/csv.csv'" />
    <xsl:function name="fn:getTokens" as="xs:string+">
        <xsl:param name="str" as="xs:string" />
        <xsl:analyze-string select="concat($str, ',')" regex='(("["]*")+|[,]*),'>
            <xsl:matching-substring>
            <xsl:sequence select='replace(regex-group(1), "^""|""$|("")""", "$1")' />
            </xsl:matching-substring>
        </xsl:analyze-string>
    </xsl:function>
    <xsl:template match="/" name="main">
        <xsl:choose>
        <xsl:when test="unparsed-text-available($pathToCSV)">
            <xsl:variable name="csv" select="unparsed-text($pathToCSV)" />
            <xsl:variable name="lines" select="tokenize($csv, ' ')" as="xs:string+" />
            <xsl:variable name="elemNames" select="fn:getTokens($lines[1])" as="xs:string+" />
            <root>
            <xsl:for-each select="$lines[position() &gt; 1]">
                <row>
                <xsl:variable name="lineItems" select="fn:getTokens(.)" as="xs:string+" />
                <xsl:for-each select="$elemNames">
                    <xsl:variable name="pos" select="position()" />
                    <elem name="{.}">
                    <xsl:value-of select="$lineItems[$pos]" />
                    </elem>
                </xsl:for-each>
                </row>
            </xsl:for-each>
            </root>
        </xsl:when>
        <xsl:otherwise>
            <xsl:text>Cannot locate : </xsl:text><xsl:value-of select="$pathToCSV" />
        </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>
    Is this correct?
    -Gouri

  • Name Value pairs

    Hi All,
    I am trying to achieve the following using the graphical mapping tool.
    Source:
    rows..................0-unbounded
    .....indicator1......1-1
    .....indicator2......1-1
    .....indicator3......1-1
    Target:
    Attributes...........0-unbounded
    .....constant............1-1
    .....field...................1-1
    Sample Source xml:
    <rows>
    ....<indicator1>Blue</indicator1>
    ....<indicator2>Large</indicator2>
    ....<indicator3>Hot</indicator3>
    </rows>
    In the target structure, I want to create name value pairs where constant1 is assigned constant 'Colour' and field1 is assigned indicator1.
    My issue is that in the target structure, I also want to create new name value pairs for each of the values in the source. This is illustrated in the target document example below:
    <Attributes>
    ......<constant>"Constant"</constant>
    ......<field>indicator1</field>
    </Attributes>
    <Attributes>
    ......<constant>"Constant"</constant>
    ......<field>indicator2</field>
    </Attributes>
    <Attributes>
    ......<constant>"Constant"</constant>
    ......<field>indicator3</field>
    </Attributes>
    An example would be (using the sample values above):
    <Attributes>
    ......<constant>Color</constant>
    ......<field>Blue</field>
    </Attributes>
    <Attributes>
    ......<constant>Size</constant>
    ......<field>Large</field>
    </Attributes>
    <Attributes>
    ......<constant>Wash</constant>
    ......<field>Hot</field>
    </Attributes>
    Can this be achieved in the graphical mapping tool before I turn to xslt?
    Please help!
    Regards,
    JS

    Hi - I have marked as helpful answer but I fear that I did not make it clear in my original question...
    The JDBC fragment below needs to be converted to the XML fragment... I am having difficulty doing this in the graphical interface.
    Thank you for your helpful answer up to now.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Debtor_JDBC xmlns:ns0="urn:finance">
       <row>
          <NO_BUNDLE>1</NO_BUNDLE>
          <PROMPT_SHIP_TO>0</PROMPT_SHIP_TO>
       </row>
    </ns0:Debtor_JDBC>
    <?xml version="1.0" encoding="UTF-8"?>
    <MASTER>
        <Debtors>
            <Attributes>
                <attributetype IsValueSet="1">1</attributetype>
                <name IsValueSet="1">No Bundle</name>
                <value IsValueSet="1">1</value>
            </Attributes>
            <Attributes>
                <attributetype IsValueSet="1">1</attributetype>
                <name IsValueSet="1">PromptForAddress</name>
                <value IsValueSet="1">0</value>
            </Attributes></Debtors>
    </MASTER>

  • HTTP adapter as receiver to POST name-value pairs - How to?

    Hi,
    Scenario: HTTP Sender <> XI <> HTTP receiver (Sync throughout; no BPM)
    In this scenario, a HTTP channel is configured to the target URL to post data.
    The message mapping results in a XML. HTTP posts the same XML to the target URL.
    However,the target URL expects data Posted as name-value pairs.
    eg. eid=45678&zip=11011&ename=Tom%20Lee
    How can we configure HTTP adapter channel to post XML data as
    name-value pairs (as in standard HTTP Form Post)?
    Any pointers?
    thanx,
    Pops

    Hi Udo,
    I currently have a solution (simpler than having a BP), but do not expect it to be the right way of doing.
    I am using Java Mapping to convert the XML structure into Name-Value pair. So the output of Mapping is a string like how HTTP post is expected. So the interface mapping having multiple mappings - firstly, the original Message mapping, and then the Java mapping to do the conversion. So, with a small extension, the solution is still kept simple.
    However, I thought the POST requirement to HTTP URLs would be a common requirement, and expected the HTTP adapter doing this conversion. So, I am still looking for a straight solution (without any custom extensions).
    Any one else faced this situation?
    Can't this be handled by HTTP Adapter?
    -- Pops V

  • Vertical Tables (name value pairs)

    I inherited the maintenance of a system built on Oracle. To make it 'configurable', the user data is stored in a single table as name value pairs. What I mean is, instead of creating a new table when the end user needs a new record type, all data is stored in a single table where one column is the record ID, one column is the attribute name, and another column is the value that is associated with that attribute.
    In other words, if I had a new record type that had two attributes, 'Name' and 'Age', instead of having a table that looks like this:
    Name Age
    Jim 10
    Joe 25
    John 45
    I have a table that looks like this:
    Record Attribute Value
    1 Name Jim
    1 Age 10
    2 Name Joe
    2 Age 25
    3 Name John
    3 Age 45
    This table can easily have several million records in it. As you can guess, the query statements are pretty tangled and run very slow.
    Does anyone have any clever ideas (aside from scrapping this approach and migrating to real tables) that can simplify this monster and improve its performance? Indexing helped the performance (it is now only awful instead of unusable), but it is still slow and a nightmare for us to maintain.
    Thanks,
    Ron

    Hi,
    But what do you enter in the value column in fixValues?
    Consider the input:
    <Pair>
    ........<Name>Vishal</Name>
    ........<Value>100</Value>
    </Pair>
    <Pair>
    ........<Name>Andy</Name>
    ........<Value>200</Value>
    </Pair>  and so on..
    Requirement is:
    If Name=Vishal, ABC(target field) should have corresponding Value(i.e 100 in this case)
    If Name=Andyl, XYZ(target field) should have corresponding Value(i.e 200 in this case)
    I did use fixValues, but always only ABC gets created properly. XYZ doesn't get created.

  • Name-value pair

    Hi,
    The following data is encoded as a string of name value pairs separated by semi colons.
    ST 0.04398148148148148;AT 0.0625;SW 0.05555555555555555;TC 0.07523148148148148;GA 0.11921296296296297;AG 0.12037037037037036;CC 0.16203703703703703;CA 0.12615740740740738;AC 0.08680555555555555;AA 0.14699074074074076;
    I want to create ST,AT,TC .... as separate columns and store the values in those columns respectively. Can anyone tell me how can I extract the data into those columns from one single column. All the above data is stored in one single column - nucleotide.
    Thanks
    Suresh

    There is more than one way to slice a cabbage. Here is the pipelined function approach, if you're using Oracle 9i or higher.
    SQL> create or replace type nucleotide as object (code varchar2(4), amt number);
      2  /
    Type created.
    SQL> create or replace type nucleotide_nt as table of nucleotide
      2  /
    Type created.
    SQL> create table gene_data (nucleotide_text varchar2(4000))
      2  /
    Table created.
    SQL> insert into gene_data
      2  values ('ST 0.04398148148148148;AT 0.0625;SW 0.05555555555555555;'
      3  ||'TC 0.07523148148148148;GA 0.11921296296296297;AG 0.12037037037037036;'
      4  ||'CC 0.16203703703703703;CA 0.12615740740740738;AC 0.086805555'
      5  ||'55555555;AA 0.14699074074074076;')
      6  /
    1 row created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION split_nucleotides
      2      (p_string in varchar2)
      3      RETURN nucleotide_nt
      4      PIPELINED
      5  AS
      6      return_value nucleotide := nucleotide(null,null);
      7      remainder varchar2(4000);
      8      offset pls_integer;
      9  BEGIN
    10      remainder := p_string;
    11      LOOP
    12       return_value.code := substr(remainder, 1, instr(remainder, ' ')-1);
    13       remainder := substr(remainder, instr(remainder, ' ')+1);
    14       return_value.amt := to_number(substr(remainder, 1,instr(remainder, ';')-1 ));
    15       PIPE ROW (return_value);
    16   exit when instr(remainder, ' ') = 0;
    17       remainder := substr(remainder, instr(remainder, ';')+1);
    18     END LOOP;
    19     RETURN;
    20  END;
    21  /
    Function created.
    SQL>
    SQL> select * from table(select SPLIT_NUCLEOTIDES(nucleotide_text) from gene_data)
      2  /
    CODE        AMT
    ST   .043981481
    AT        .0625
    SW   .055555556
    TC   .075231481
    GA   .119212963
    AG    .12037037
    CC   .162037037
    CA   .126157407
    AC   .086805556
    AA   .146990741
    10 rows selected.
    SQL> Cheers, APC

  • Unrecognized name-value pair: log_set_config

    I am using BDB SQLITE and trying to configure in-memory logging and the contents of my DB_CONFIG file are
    add_data_dir ..
    log_set_config DB_LOG_IN_MEMORY on
    set_lg_bsize 1048576000
    set_lg_max 512000000
    set_cachesize 0 524288000 1
    #set_cache_max 0 524288000
    #set_open_flags DB_PRIVATE on
    I get the following error when trying to create a database
    unrecognized name-value pair: log_set_config
    ERROR: SQL logic error or missing database. ERRCODE: 1.
    Is there any issue with the way I have defined the paramater for DB_LOG_IN_MEMORY?
    Also can DB_PRIVATE parameter be used when using BDB SQLITE? I remember when I tried the last time it gave me error suggesting that the flag configuration was illegal.
    Please advice
    Edited by: user10942853 on Oct 22, 2010 8:13 AM

    user10942853 wrote:
    log_set_config DB_LOG_IN_MEMORY on
    Is there any issue with the way I have defined the paramater for DB_LOG_IN_MEMORY? The DB_LOG_IN_MEMORY flag documentation is available here: http://download.oracle.com/docs/cd/E17076_01/html/api_reference/C/envlog_set_config.html#log_set_config_DB_LOG_IN_MEMORY
    As you can see, there is no specification that you can use log_set_config in DB_CONFIG, I don't know where you took this from. What you can do, you can configure the DB_LOG_IN_MEMORY flag by using "set_flags db_log_inmemory" in the DB_CONFIG file.
    user10942853 wrote:
    Also can DB_PRIVATE parameter be used when using BDB SQLITE? I remember when I tried the last time it gave me error suggesting that the flag configuration was illegal.How did the exact message look like and what Oracle BDB release are you using?
    Thanks,
    Bogdan Coman

  • Need to retrive the name-value pair of concurrent request

    Hello All,
    I need to write a query that takes the concurrent request ID (executed concurrent request) as input and retrives the concurrent request parameter names and the values submitted to run that request.
    we have considered the following tables to acheive the result:
    fnd_descr_flex_col_usage_tl
    fnd_concurrent_requests
    fnd_concurrent_programs
    however unable to map the parameter name-value pairs properly.
    Thanks
    Krrish

    declangallagher .. I am sorry for not being very clear ...
    I am sorry for taking your time.But I appreciate your effort .and time ..
    I
    I have two servlets 1. result (existing) 2. preResult ( probable wrap around)
    The servlet
    1.result : takes in the Name and gets the result from the db ( Actually uses Castor and JDO ) to get the result
    and the GET is as follows
    http://128.173.99.68:8080/WebApplication/result?queryFor=Experiment&Name="john"
    where "queryFor" is for the name of the form and Name is the text in the VTL ( View)
    2.preResult is supposed to be a wrapper around the servlet "result" this takes in the ID from the user
    and is of the form
    http://128.173.99.68:8080/WebApplication/preResult?queryFor=Wrapper&ID="1234"
    There exists a DB mapping to ID and Name .
    So Instead of calling the result servlet ..I'll directly call the preResult servlet ...get the ID from the user ...
    and get the corresponding Name from the db
    ....here
    I wish to (If possible) tweak the "request" parameter
    change
    1.The queryFor value to Experiment
    2. add The Name="john"
    and send this to the result servlet so that it process it ...........

  • Remove a name/value pair from request

    Hi, guys:
    I am trying to programmatically remove a name/value pair from
    request in my jsp file. For example, if I have a path like
    the following:
    http://localhost:8080/mysampleweb/initpage?isHome=true
    If I want to remove "isHome=true" and produce the following
    path:
    http://localhost:8080/mysampleweb/initpage
    Is there a way to do it?
    regards,

    I think you can use respose.sendRedirect(request.getRequestURI())

Maybe you are looking for

  • Get variable in Target currency under currency conversion Tab for Key Figure

    Hi Experts, In one of the query in BEx Designer, for particular set of key figures I am unable to edit Target Currency under currency conversion. We created user exit and using a variable in BEx. When I chose currency conversion parameter in "Currenc

  • Need the approach for passing source to proxy and idocs

    Hi PI mates, i  was struck in implementing one scenario.here is my scenario..i am getting source message (webservice call) and i need to pass it to table fields and as well standard idocs at the same time...for updating tables we are going with proxy

  • Proxy configuration in ECC

    Hello everyone, I am trying to set up Proxy between SAP ECC and PI  7.1 . Below is the steps done. 1. Set up HTTP Connection type G in ECC 2. Set up TCP/IP Connection LCRSAPRFC AND SAPSLDAPI 3. Go to SXMB_ADM --> Intg Server Configuration --> It is d

  • Keyframing vanes

    Any thoughts would be appreciated. I need to create an animation of a rotary pump. Inside the pump are several vanes. Think of these as narrow rectangular objects residing within a circle. The objects (vanes) extend from the center of the circle out

  • Audio file not playing - CS6 After Effects

    I am taking a Motion Design class and the .mov file that has the audio clip I need was provided by the instructor and worked in class using CS5 After Effects. When I try to work on the movie at home, the audio file does not play. Does the audio file