How to write XSLT codeing in file to file using XSLT mapping?

Hi ,
Experts,
I am new to XSLT coding as iam doing File to File XSLT Mapping for i have created IR and ID part and i have wriiten XSLT codeing which is not working.
source structure:                     Target structure
Fname                                    Name  = (Fname+Lname)
Lname
maths   
science                                   Total_marks = (mathssciencesocial)
social   
<?xml version='1.0' ?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:aash="http://xlst.file2file" xmlns:ns0="http://xlst.file2file">
<xsl:template match="/">                                               |
<aash:mt_student_result>                                      this is my Naming Space
<Data>
<Name>
<xsl:value-of select="concat(ns0:mt_student/data/FName,ns0:mt_student/data/LName)"/>
</Name>
<Marks>
<Total_Marks>
<xsl:value-of select="(ns0:mt_student/data/Marks/Maths)(ns0:MT_Student/Data/Marks/Science)(ns0:mt_student/data/Marks/Social)"/>
</Total_Marks>
</Marks>
</Data>
</aash:mt_student_result>
</xsl:template>
</xsl:transform>
while testing in Interface mapping the values are not comming into result side please verify the code and suggest me the correct one.
Thanks in advance
shabeer ahmed.

Hi Shabeer,
PFB, the corrected XSL.
try using it, it would work.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:aash="http://xlst.file2file" xmlns:ns0="http://xlst.file2file">
<xsl:template match="/"> |
<aash:mt_student_result> this is my Naming Space
<Data>
<Name>
<xsl:variable name="vFName" select="ns0:mt_student_result/Data/FName"/>
<xsl:variable name="vLName" select="ns0:mt_student_result/Data/LName"/>
<xsl:value-of select="concat($vFName,$vLName)"/>
</Name>
<Marks>
<Total_Marks>
<xsl:variable name="vMaths" select="ns0:mt_student_result/Data/Marks/Maths"/>
<xsl:variable name="vScience" select="ns0:mt_student_result/Data/Marks/Science"/>
<xsl:value-of select="concat($vMaths,$vScience)"/>
</Total_Marks>
</Marks>
</Data>
</aash:mt_student_result>
</xsl:template>
</xsl:transform>
I have given input as,
<?xml version="1.0" encoding="UTF-8"?>
<ns0:mt_student_result xmlns:ns0="http://xlst.file2file">
          <Data>
               <FName>FName</FName>
               <LName>LName</LName>
               <Marks>
               <Maths>M</Maths>
               <Science>S</Science>
               </Marks>
          </Data>
</ns0:mt_student_result>
Output was,
<?xml version='1.0' ?>
|
<aash:mt_student_result xmlns:sap="http://www.sap.com/sapxsl" xmlns:ns0="http://xlst.file2file" xmlns:aash="http://xlst.file2file"> this is my Naming Space
<Data><Name>FNameLName</Name><Marks><Total_Marks>MS</Total_Marks></Marks></Data></aash:mt_student_result>
It worked.Try it out.
Regards,
Swetha.

Similar Messages

  • How to write data to text file using external tables

    can anybody tell how to write data to text file using external tables concept?

    Hi,
    Using external table u can load the data in your local table in database,
    then using your local db table and UTL_FILE pacakge u can wrrite data to text file
    external table
    ~~~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
    UTL_FILE
    ~~~~~~~~~
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
    Message was edited by:
    Nicloei W
    Message was edited by:
    Nicloei W

  • How to write a CLOB to file using UTF-8

    I'm new to java and I have the following problem.
    I need to write a CLOB to file using the UTF-8 characterset (I'm generating an xml file). My database characterset is WE8ISO8859P15.
    I've tried the code below but the resulting output fails validation in an xml editor due to an 'invalid character' error :
    create or replace
    and compile
    java source named "ClobUtil"
    as
    import java.io.*;
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    public class ClobUtil {
    public static void save(CLOB clob, String filename) throws Exception
    Connection conn = DriverManager.getConnection("jdbc:oracle:kprb:");
    conn.setAutoCommit(false);
    InputStream is = clob.getCharacterStream();
    FileOutputStream os = new FileOutputStream(filename);
    int size = clob.getChunkSize();
    byte buffer[] = new byte[size];
    int length;
    while ((length = is.read(buffer, 0, size)) != -1) {
    os.write(buffer, 0, length);
    is.close();
    os.close();
    conn.close();
    I see that the getCharacterStream() method returns a Unicode character stream but how do I output this to file ??
    Thanks in advance

    File file = new File( "myfile.utf8" );
    FileOutputStream fos = new FileOutputStream( file );
    OutputStreamWriter osw = new
    OutputStreamWriter( fos, "UTF8" );
    Writer w = new BufferedWriter( osw );
    PrintWriter out = new PrintWriter( w );
    Or whatever you need. Note that this merely allows you to specify the encoding to be used in the output file, it does convert the encoding for you. I think in your case this will work since you already know the output stream will not contain the full range of UTF8 characters anyway.

  • How to write newline character to file using bytes along with content

    Hi All,
    I need to write headers into the file using byte[]. I am creating the strings of header which will form the different rows in the file. I am new to java and would like to know how to embed new line character so that when the byte[] is written to file headers come in different rows.
    like
    hrd1:abcd
    hdr2:1234
    when i embed \n and \r in string and do getBytes() and write it to file, some boxes are written in the file and everything comes into single line.
    Please advice me the correct way .
    Thanks in advance.
    Cheers!!
    Puneet

    not sure about it, but i was always told that "\r\n" meant "new line" on "lots of documents" whereas "\n" only or "\r" only were meaningless on some type of documents

  • How to Write data in Excel File using java

    Hi
    can anybody help me to write data in excel file
    using java code
    Thankx In Advance

    How much are you willing to pay for that?
    If you want it for free, http://jexcelapi.sourceforge.net/

  • How to write data to existing file using spool command?

    Hi,
    I am calling a stored procedure from a shell script. This stored procedure is having a CLOB object as an OUT parameter. How to write the data in CLOB object a existing file which is there in my client system. Below is the shell and sql scripts.
    Shell script
    ( echo "hello" ) > /root/file.txt
    sqlplus -s $user/$pass@$tns @/root/proc.sql /root/file.txt << EOF
    EOFSQL script
    set pages 0
    set trimspool off
    set serveroutput off
    set feedback off
    set term off
    set echo off
    variable out CLOB
    define file='&1'
    begin
    pack.proc(:out);
    end;
    spool &file
    select :out from dual;
    spool offThis code writes contents of the OUT variable to file.txt, but my existing data ('hello') is lost. Please help me.
    I figured the it...Use append in the spool command... :)
    Edited by: Balaji on Jul 19, 2012 8:55 PM

    >
    Hi Balaji
    I figured the it...Use append in the spool command... :Please mark the thread as answered as per the FAQ.
    Paul...

  • How to download ANSI coding text file using function GUI_DOWNLOAD?

    Hi All,
      Is the coding page of the file created by funtion GUI_DOWNLOAD or WS_DOWNLOAD is ANSI or UTF-8? How to download a text file which's coding page is ANSI please?
    Is this correct?
    CALL function 'GUI_DOWNLOAD'
      exporting
      codepage = '4110'
    importing

    This Function Lodule will give the CODE PAGE VALUE
    SCP_CODEPAGE_BY_EXTERNAL_NAME ... You have to give type of tht ENcoding like ANSI ..etc
        call function 'GUI_DOWNLOAD'
          exporting
           filename                        = 'd:\customer_details.txt'
           filetype                        = 'ASC'
       CODEPAGE                        = code
          tables
            data_tab                        = t_customer_details
      FIELDNAMES                      =
         exceptions
           file_write_error                = 1
           no_batch                        = 2
           gui_refuse_filetransfer         = 3
           invalid_type                    = 4
           no_authority                    = 5
           unknown_error                   = 6
           header_not_allowed              = 7
           separator_not_allowed           = 8
           filesize_not_allowed            = 9
           header_too_long                 = 10
           dp_error_create                 = 11
           dp_error_send                   = 12
           dp_error_write                  = 13
           unknown_dp_error                = 14
           access_denied                   = 15
           dp_out_of_memory                = 16
           disk_full                       = 17
           dp_timeout                      = 18
           file_not_found                  = 19
           dataprovider_exception          = 20
           control_flush_error             = 21
           others                          = 22
        if sy-subrc <> 0.
          write : / 'Upload Failed' , sy-subrc.
        else.
          write : / 'Upload Completed'.
        endif.
      endif.
    Reward if helpful...

  • How to write to a log file within a JSP

    Hello everybody,
    do you know how to write to a log file within a JSP.
    my code is (/space/SP/tlf/ExcepcionJava.jsp):
    <html>
    <body bgColor=#C4E1FF>
    <%@ page import="java.io.*" %>
    <%
         FileWriter salida = new FileWriter(response.encodeURL("log.txt"));
         salida.write(request.getParameter("errorMsg"));
         salida.close();
    %>
    </body>
    </html>.. I run under Solaris, Jrun 2.3.3
    I have also test with getServletContext().getRealPath(), but I get /netsrv/nes/docs/ instead of /space/SP/tlf/

    Hi,
    Give the full path of the log file to the FileWriter. Such as;
    FileWriter salida = new FileWriter(response.encodeURL("/usr/local/tomcat/logs/testlogs/log.txt"));
    nurettin

  • How to write a Xml installation file to build  web installer using IzPack.

    Hai everyone,
    I have got a problem in building a web installer using IzPack.I am getting this exception,when I am compiling my install.xml using a compile tool provided by IzPack soft.Eventhough I have not mentioned "packsinfo.xml" in my Xml installation file.
    Fatal error :
    null\packsinfo.xml (The system cannot find the path specified)
    java.io.FileNotFoundException: null\packsinfo.xml (The system cannot find the path specified)
    What went wrong??
    It is very very urgent. Could anyone tell me how to write a Xml installation file for building web installer,please??
    any help will be highly appreciated....
    Thank you very much in advance

    Hi,
    that is not really a java related question. Have you tried to find some IzPack support forum? I've never heard about it, so I can't help.

  • How to write code for save file directory?

    how to write code for save file directory?

    how to find usa timezone code using java swing?
    i have some code help me
    public class ItsInitializer {
    private static boolean s_initialized = false;
    private ItsInitializer() {
    public static synchronized void initialize() {
    if (!s_initialized) {
    // Modifies default time zone, disables Daylight Saving Time.
    TimeZone l_defaultTimeZone = TimeZone.getDefault();
    int l_rawOffset = l_defaultTimeZone.getRawOffset();
    String l_id = l_defaultTimeZone.getID();
    SimpleTimeZone l_simpleTimeZone = new SimpleTimeZone(l_rawOffset,
    l_id,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0);
    TimeZone.setDefault(l_simpleTimeZone);
    s_initialized = true;
    2.
    long timeMillis = ...;
    long time = timeMillis / 1000;
    String seconds = Integer.toString((int)(time % 60));
    String minutes = Integer.toString((int)((time % 3600) / 60));
    String hours = Integer.toString((int)(time / 3600));
    for (int i = 0; i < 2; i++) {
         if (seconds.length() < 2) {
              seconds = "0" + seconds;
         if (minutes.length() < 2) {
              minutes = "0" + minutes;
         if (hours.length() < 2) {
              hours = "0" + hours;
    3.
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class Convert {
    public String getDateTime(String pattern){
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    return sdf.format(new Date());
    * @param args
    public static void main(String[] args) {
    Convert con = new Convert();
    System.out.println(con.getDateTime("hh:mm:ss"));
    5.import java.text.SimpleDateFormat;
    import java.util.Date;
    public class Convert {
    public String getDateTime(String pattern){
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    return sdf.format(new Date());
    * @param args
    public static void main(String[] args) {
    Convert con = new Convert();
    System.out.println(con.getDateTime("hh:mm:ss"));
    [ November 23, 2005: Mess
    private Locale locale = Locale.US;
    private static final String[] tzStrings = {
    "America/New_York",
    "America/Chicago",
    "America/Denver",
    "America/Los_Angeles",
    Date now = new Date();
    for ( TimeZone z : zones) {
    DateFormat df = new SimpleDateFormat("K:mm a,z", locale);
    df.setTimeZone(z);
    String result = df.format(now);
    System.out.println(result);
    String date="05/19/2008 04:30 AM (EST)";
                   SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm aaa (z)");
                   TimeZone.setDefault(TimeZone.getTimeZone("PST"));
                   long millis = sdf.parse(date).getTime();
                   sdf.setTimeZone(TimeZone.getDefault());
                   System.out.println(sdf.format(new Date(millis)));
    [ November 23, 2005: Mes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How do I edit a PDF file using Acrobat 9 - Version 9.4.0

    My company - [name deleted by host] purchased Acrobat 9 - Version 9.4.0. for me
    How do I edit a PDF file using Acrobat 9 - Version 9.4.0
    I need to edit - copy, extract text, add text, etc. from existing PDF files to SAVE my changes,
    or create a new PDF file from an existing file.
    This is very important for me to be able to do my job effectively.
    I spent over 2 hrs the last few days, and another hour today, still can't do it.
    PLEASE respond ASAP with a solution.
    Thanks in advance,
    - Daulton West
    [signature deleted by host]

    PDF is an end destination format - although Acrobat is capable of making minor changes to a file (e.g. to correct typos) it is not a word processor or DTP application. Major changes must be done in the original document, and the PDF file re-exported.
    You can copy text from a file by selecting it and right-clicking, or you can save the file as plain or formatted text. To make small changes to the text on a page, use the touchup tool - see the help file for more info.

  • How do I produce an excel file using java code

    How do i produce an excel file using java code.
    If it is possible would ne one have ne source code as an example.
    I have tried looking up information on outputing the information to a *.csv file but unfortunality i have had no luck in finding any information. To be exact ne source code.
    Thanks
    Lee

    That's what I use and I'd be the first to admit that it's very messy. But it works. Go use Google and see what else you can find.

  • How do I open a .dd file using OS X?

    I had a corrupt external HDD which i used to use with an old laptop. I used data recovery software and managed to recover 33gb of data. However it is saved in the old diskdoubler format. (.dd file extension). How do I open a .dd file using OS X? ive tried stuffit and unarchiver but they dont work. any help?

    Look at these links.
    http://forums.appleinsider.com/archive/index.php/t-40241.html
    http://www.enews.org/blog/2009/03/opening-diskdoubler-files-from-mac-os-9.html
     Cheers, Tom

  • How do I generate the pdf file using the name of a field.  How can I help

    how do I generate the pdf file using the name of a field.  How can I help

    Hi,
    here's a sample.
    LiveCycle Blog: Formulare in bestimmte Verzeichnisse speichern und nach Inhalt aus Formularfeld benennen //Save forms to…

  • How to create and read text file using LabVIEW 7.1 PDA module?

    How to create and read text file using LabVIEW 7.1 PDA module? I can not create a text file and read it.
    I attach my code here.
    Attachments:
    File_IO.vi ‏82 KB

    Well my acquisition code runs perfect. The problem is reading it. I can't seem to read my data no matter what I do. My data gets saved as a string using the array to string vi but I've read that the string to array vi (which I need to convert back to array to read my data) does not work on the pda. I'm using version 8.0. So I was trying to modify the program posted in this discussion so that it would save data from my DAQ. I did that but I still can't read the data after its saved. I really don't know what else to do. All I need to do is read the data on the pda itself. I can't understand why I'm having such a hard time doing that. I found a possible solution on another discussion that talks about parsing the strings because of the bug in the "string to array" vi. However, that lead me to another problem because for some reason, the array indicators or graphs don't function on the pda. When i build the program to the pda or emulator, the array indicators are faded out on the front panel as if the function is not valid. Does this kind of help give a better picture of what I'm trying to do. Simply read data back. Thanks.

  • How can i rename a jar file using only java code

    i have tried everything i can think of to accomplish this but nothing works.

    ghostbust555 wrote:
    In case you geniuses haven't realized I said I tried everything I can think of not that I tried everything. So help or shut up I realize that I didn't try everything but if you can't figure it out either DO NOT POST.
    And the question is how can i rename a jar file using java code? As it says in the title. Read.I would tell you to use the File.renameTo method, but surely that would have been obvious, and you would have tried it already? But maybe you didn't. You were kind of lacking in details in what you tried.
    And yes, I am a genius. Just don't confuse "genius" with "mind-reader".

Maybe you are looking for