Formatting output using XSL

Hi All,
Here is my XML output from an XSQL file.
<ROWSET>
- <ROW num="1">
<EMP_NAME>Employee A</EMP_NAME>
<WEEK_NUM>3</WEEK_NUM>
<NOOFDAYS>5</NOOFDAYS>
</ROW>
- <ROW num="2">
<EMP_NAME>Employee A</EMP_NAME>
<WEEK_NUM>4</WEEK_NUM>
<NOOFDAYS>5</NOOFDAYS>
</ROW>
- <ROW num="3">
<EMP_NAME>Employee A</EMP_NAME>
<WEEK_NUM>5</WEEK_NUM>
<NOOFDAYS>5</NOOFDAYS>
</ROW>
- <ROW num="4">
<EMP_NAME>Employee B</EMP_NAME>
<WEEK_NUM>4</WEEK_NUM>
<NOOFDAYS>5</NOOFDAYS>
</ROW>
- <ROW num="5">
<EMP_NAME>Employee B</EMP_NAME>
<WEEK_NUM>7</WEEK_NUM>
<NOOFDAYS>5</NOOFDAYS>
</ROW>
- <ROW num="6">
<EMP_NAME>Employee B</EMP_NAME>
<WEEK_NUM>9</WEEK_NUM>
<NOOFDAYS>4</NOOFDAYS>
</ROW>
- <ROW num="7">
<EMP_NAME>Employee C</EMP_NAME>
<WEEK_NUM>3</WEEK_NUM>
<NOOFDAYS>2</NOOFDAYS>
</ROW>
- <ROW num="8">
<EMP_NAME>Employee C</EMP_NAME>
<WEEK_NUM>4</WEEK_NUM>
<NOOFDAYS>5</NOOFDAYS>
</ROW>
- <ROW num="9">
<EMP_NAME>Employee C</EMP_NAME>
<WEEK_NUM>7</WEEK_NUM>
<NOOFDAYS>4</NOOFDAYS>
</ROW>
So I am getting XML in form of:
Employee A: Week 3: Noofdays : 5
Employee A: Week 4: Noofdays : 5
Employee A: Week 5: Noofdays : 5
Employee B: Week 4: Noofdays : 5
Employee B: Week 7: Noofdays : 5
Employee B: Week 9: Noofdays : 4
Employee C: Week 3: Noofdays : 2
Employee C: Week 4: Noofdays : 5
Employee C: Week 7: Noofdays : 4
And now I need to generate and output in Cross tab format where Employee is in X-axis and Week is in Y axis. Now my XML does'nt contain information for all the weeks and I want to display 0 in the cell wherever the week is not applicable and the appropriate noofdays in the cell where information is there.
So my output looks like this:
Empl Name 1 2 3 4 5 6 7 8 9 10
Emp A 0 0 5 5 5 0 0 0 0 0
Emp B 0 0 0 0 5 0 5 0 4 0
Emp C 0 0 2 5 0 0 4 0 0 0
How can I generate such output using XSL. I even tried <xsl:key> but its not working fine. Can anyone have any ideas for generating such output using xsl.
Any help in this will be highly appreciated. Its bit urgent...
Thanks

Hi All,
Well I got the solution for this. The exact XSL for generating Crosstab report is as follows:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:key name="x" match="ROW" use="ROWS"/>
<xsl:template match="/page">
<html>
<center>
<body bgcolor="#FFFFFF" text="#000000">
<table width="75%" border="1" style="background-color:#F5DEB3">
<th style="background-color:#BBBBBB">Employee Name</th>
<xsl:for-each select="ROWSET/ROW/COLH">
<th style="background-color:#BBBBBB">
<xsl:value-of select="."/>
</th>
</xsl:for-each>
<xsl:for-each select="//page/ROWSET/ROW[generate-id()=generate-id(key('x',ROWS))]">
<xsl:variable name="currow" select="ROWS"/>
<tr>
<td><xsl:value-of select="$currow"/></td>
<xsl:for-each select="//page/ROWSET/ROW/COLH">
<xsl:variable name="curcol" select="."/>
<td align="center">
<xsl:for-each select="/page/ROWSET/ROW[ROWS=$currow]">
<xsl:if test="$curcol=COLS">
<xsl:value-of select="CELLS"/>
</xsl:if>
</xsl:for-each>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
Back
</body>
</center>
</html>
</xsl:template>
</xsl:stylesheet>
I hope this will help others.
Thanks
null

Similar Messages

  • Transform LiveCycle form xml output using xsl

    I've completed my first form but now want to format the xml that's generated.
    Whilst I work for a big Company, I don't think they'll stretch to purchasing the Reader Extensions Module so I can output as PDF. Also there will be more than 500 users completing the form, so I can't just extend the rights using Adobe Acrobat.
    Therefore, I'd like to transform the xml created using xsl (as I have knowledge in this area) - I'd like the transformation to occur when the form is submitted via email so that a 'friendly' attachment is added to the email and not the xml output.
    Any ideas on this one?

    First thing is, the fonts did not work in my system.. So I can not really understand where the email address fields are..
    Few things:
    1) You have used an Email submit button and tried to place the code in the MouseDown event.
        You need to change this button to "Regular Type Button". and place the code in the Click event to work.
    2) I placed a sample button and put in my code for your reference.. This is working fine..You can check the below sample.
    https://acrobat.com/#d=tQa4E*8aA*mJq6aijSHuDQ
    3) You can do the same way for your form..
    4) If you have Acrobat software, you can enable JavaScript debugger which can give you the specific error message rather than Submit cancelled. If you do not, then you need to put some messageBox statements and check..
    Thanks
    Srini

  • Formatting output using FileWriter

    Hi Experts,
    Just a quick question, I have a FileWriter which grabs some text from a JTextPane and then outputs it to a pre-defined textfile, all works well until I open the textfile, instead of the nice formatted text I get from JTextPane, it all spans one line!
    Anybody out there know how tof ormat the output, so it looks exactly like the JTextPane?
    Thanks,
    Reacz.

    Get the text from the JTextPane and write it to the FileWriter one line at a
    time. Wrap the FileWriter in a BuffreredWriter so you can take advantage of
    the latter's newLine() method.
    Anybody out there know how tof ormat the output, so it looks exactly like the
    JTextPane?Strictly speaking the output (a file) doesn't look like anything. It only looks like
    something when you view it in some application or other. If you separate
    each line of output with newLine() then you will be using the new line separator
    that is the "default" for your OS. This at least maximises the chances of it
    being right for whatever application you are using to view the file.

  • Formatting output using StringBuffer

    I need to write a report to a flat file. The format of the data in in colmns. When I run this in windows it works but in unix the spacing is wrong. Please advise.
    public class StringBufferTest
         public static void main(String [] args)
              String test;
              String a = "Vendor";
              String b = "Prefix";
              String c = "Code";
         StringBuffer sb = new StringBuffer(a);
         sb.setLength(50);
         sb.insert(30, b);
         sb.insert(45, c);
              test = sb.toString();
              System.out.println(test);
    }

    Sounds like not a very good suggestion.
    For future reference in case someone runs across this Unix issue this is what I did.
    for (int j = 0; j < (bufferMax - cardName.length()); j++)
    padding = padding + " ";
    tmpName = cardName[i] + padding;
    StringBuffer holder = new StringBuffer(tmpName);

  • URI format for using XSL document function.

    Hi Tim,
    >>but I am not able to figure out where I should place the xml file. What are best practices for choosing a location for the xml file?
    You can place the xslt code and xml file in a single folder, zip it an import it into PI as an external definition. I think this should work
    Regards
    Suraj

    Thank you for your reply.    But my requirements are such that they need to be independent, and not be in the same imported archive (ie ZIP file).    In my case the XSLT code is a standard product that is the same across multiple installations,  but each installation may required some installation specific cross reference values that would be maintained in the XML file.    So I need them separated so if I make updates to my XSLT and distribute it, I do not wipe out the installation specific settings that have been made to the XML file.

  • Xml report output in excel format without using options tab in EBS

    How to get xml publisher report output in excel format without using options tab in EBS?
    I am getting XML Publisher report output in excel format by using options tab while submitting the concurrent request .
    But i want to get excel output automatically.
    Can anyone give idea to get XML publisher Report output in excel without selecting options tab.
    Thanks in advance
    Sandeep V

    Hey Sandeep,
    I am working on a similar format for a report and if possible can you please give me some guidelines. I have initially created reports using XML Publisher, but for those , the output preview format was PDF. So, if I select the preview format as EXCEL will it give me output in Excel and for this to happen, how do I define the rtf template. I believe the working will be same as for PDF, create a rdf report, get output in XML and apply the template to get the data in Excel or there is something different to this.
    Thanks,
    Sunil

  • XSL-1009 error in XML to XML using XSL

    I'm using XSL to transform one XML format to another using and XSL transform file. I'm initiating this with ORAXSL in.xml transform.xsl out.xml. The XSL file has in it:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.oracle.com/XSL/Transform/Java" version="1.0">
    <xsl:import href="../generic/parsePOHeader.xsl"/>
    <xsl:import href="../generic/parsePOLine.xsl"/>
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
    ORAXSL gives an error of XSL-1009: Attribute xsl:version not found in XSL:Stylesheet.
    Putting an XSL: prefix on the version doesn't help. A search for help on this site had a solution for XSL that create HTML.
    Has anyone else solved this problem?

    Thanks everyone for th ereply. Yes, I tested the mapping in integration bulider and it works fine. Even the file conversion works fine intermittantly! Sometimes it converts successfully and wrties file to target location and sometimes I get this error. I checkd in sxi_cache and I see the mapping xsl files there. I jus had basis reboot PI server and run some cache commands but still same problem! Also, when I have to files in source directory sometimes it converts both, sometimes one and sometimes both fails! I haveno clue what els to try.
    What are adapter nodes and wher can I check for that?
    Thanks.
    Mithun

  • My VGA output using Mini DisplayPort to VGA doesn't work.

    Since I upgraded to Mavericks, my VGA output using Mini DisplayPort to VGA doesn't work. When I was using Mountain Lion, as soon as you plugged in the Mini adaopter into the mini display port, the screen would shrink and format to where it would project via a RGB cable to a projector. No such luck since Mavericks! Also, I had a lot of trouble with the DVD player when I tried to play a DVD and project it via a projector. It all worked seamlessly with Mountain Lion. Can anyone help me?

    I think if you go to System Preferences >> Displays and Option-click on the "Scaled" radio button, it will show you all of the resolutions that you would have had before under Mountain Lion. I just upgraded to Maverick and my resolution preferences (mirrored on a TV using the Mini DisplayPort to VGA adapter, using 1280x768) were completely reset (my display was no longer mirrored, and the resolution on my main iMac screen became 2560x1440). I found my answer here: https://discussions.apple.com/message/23599645#23599645. Hope that helps.

  • Generate XML output using DBMS_XMLGEN.getxmltype and not from rdf

    Hi,
    I have a requirement to display output from a particular table in XL format. Out of all the known possible options, I am planning to use the XML publisher to generate XL output.
    For the data source, instead of using the conventional way of creating XML data using rdf,I am planning to use DBMS_XMLGEN.getxmltype pl/sql procedure to generate the XML output. And from the output, call the template to generate the required Excel output.
    Now, I am using the following code to generate XML output but am not sure how to proceed from here. I need to first print the XML data in the FND Output file after which I was planning to call the 'XML Report Publisher' (XDOREPPB) program and use the current request id to get the excel output but I am not able to find the way to print the XML data in the output file as:
    fnd_file.put_line (fnd_file.output, l_xml_type); - is throwing an error as l_xml_type is an XML data output.
    PROCEDURE xml_main (
    errbuf OUT VARCHAR2
    ,retcode OUT VARCHAR2
    ,p_project_from IN VARCHAR2
    ,p_project_to IN VARCHAR2
    AS
    l_xml_type XMLTYPE;
    BEGIN
    SELECT DBMS_XMLGEN.getxmltype
    ('SELECT fnd_global.conc_request_id
    ,TO_CHAR (segment1)
    ,to_char(start_date,''MM/DD/RRRR'')
    ,to_char(xxmcc_project_details_pkg.current_profit_projection
    (project_id),''999,999,990.90'')
    ,to_char(xxmcc_project_details_pkg.cost_to_date (project_id),''999,999,990.90'')
    ,''1''
    FROM pa_projects_all
    WHERE segment1 BETWEEN NVL (p_project_from, segment1)
    AND NVL (p_project_to, segment1)')
    INTO l_xml_type
    FROM DUAL;
         fnd_file.put_line (fnd_file.output, l_xml_type);
    END xml_main;
    Can anyone point me as to how to publish XML output using a PL/SQL procedure (DBMS_XMLGEN.getxmltype)
    Thanks.

    Pl see if the example included in this presentation helps http://www.oracle.com/technology/products/applications/Events/OOW-2006/EBS/S281401_Sridhar_Bogelli.pdf
    Also, you do not need to explicitly call XDOREPPB in later versions of XML Publisher. If you set up everything correctly (as described in the presentation above and the link below) the Output Post Processor is called automatically after the XML file is generated successfully.
    Another excellent tutorial is at http://www.oracle.com/technology/obe/fusion_middleware/fusion/bi/xmlp_ebiz/index.html
    HTH
    Srini

  • Report VS Excel output using XML Publisher tool (DBMS_XMLGEN)

    Hi All,
    Currently I am working on report generation in MRP module with Excel output using XML Publisher tool.
    XML tool works based on query.
    I have developed PLSQL block by using DBMS_XMLGEN – database package, to generate XML output of query.
    My question is how we can put generated xml on above PLSQL block into OUT file (APPS).
    Because DBMS_OUTPUT.PUT_LINE( ) has limitation, it allow 255 character string only.
    But I do not know, Is FND_FILE.PUT_LINE (FND_FILE.OUTPUT,’’) allow for large data?
    If it does not allow what will be the other solution in oracle application to resolve above problem.
    Let me know any queries regarding to this problem.
    Thanks and Regards,
    Sai Krishna @cavaya.com

    Hi Prakash,
    Thanks for the reply. We did apply the one-off patch and got rid of the problem of not viewing 'Excel' output using XMLP.
    Now we are looking at a different perspective:
    Basically our client is looking for the following:
    1. Mathematical functions in the resulting XLS (like SUM, AVG etc..) ouput
    2. Use of macros if possible.
    And to do this i am looking out for a sample template that gives me output in excel format I have a TAR with Oracle for this purpose, but the TAR has so far been unsuccessful in providing us with any material in the direction.
    Our client remembers seeing this as a demo at the Oracle Conference this yr at San Fransisco, but does not have a sample to provide us. We are looking for such a sample.
    Thx,
    Nitin

  • Initial-page-number not working in RTF format output

    A report has a parameter for the page number to start with. In rtf template below code is present
    <?initial-page-number:xdoxslt:ifelse(P_FIRST_PAGE_NUM!=’’,number(P_FIRST_PAGE_NUM),1)?>
    The report page number starts with the value which we pass in p_first_page_num in PDF format but in rtf format output it always starts with 1.
    Is initial-page-number not supported in RTF format output ? If not then what is the alternative?

    the method u followed is fine as need a page number staring from a specify value which u input.
    @section is only for resetting page number to 1 for every group and for that pdf and ppt will be fine but only for rtf u need to use that ( pressing F9).
    u can use @section and initial page number combined but they give u same output as get now. rtf output wont support it will only reset 1 every time
    What ever u do rtf output wont support initial page number code ..........
    i mentioned that F9 work around to mention that it is the only work around u have upto now to control rtf output with regards to page number.
    Guru's correct me if i am wrong. wait for a day or two if some one from guru's confirm it .
    If u need real confirmation raise an SR oracle will let u know .

  • Excel output using XML Publisher 5.5

    Hi,
    We are trying to obtain output of a simple customer summary report in 'EXCEL" format. For this purpose we have registered a 'RTF' template using which we get output in PDF/RTF formats. We are trying the 'EXCEL' format for the first time. Each time we run the concurrent request for XMLP, and then click 'View Output' we get a pop saying the following message
    "ORA-1403: no data found". The same report works perfectly fine when i run it using the template builder/viewer tool i have on my desktop. Can some throw light on this issue that we are facing.
    Please note that this is extremely important for us, as we plan to design a 'Gross Margin' report using XMLP in 'EXCEL' format and for this, this needs to work. Any inputs will be helpful.
    It would be great if someone in thr group can share a sample RTF template that generates output in 'Excel ' format.
    Tx,
    Nitin Jain

    Hi Prakash,
    Thanks for the reply. We did apply the one-off patch and got rid of the problem of not viewing 'Excel' output using XMLP.
    Now we are looking at a different perspective:
    Basically our client is looking for the following:
    1. Mathematical functions in the resulting XLS (like SUM, AVG etc..) ouput
    2. Use of macros if possible.
    And to do this i am looking out for a sample template that gives me output in excel format I have a TAR with Oracle for this purpose, but the TAR has so far been unsuccessful in providing us with any material in the direction.
    Our client remembers seeing this as a demo at the Oracle Conference this yr at San Fransisco, but does not have a sample to provide us. We are looking for such a sample.
    Thx,
    Nitin

  • Conversion from xml to csv using xsl

    hi i am converting from xml to csv using xsl i am getting the extra junk character(space) in the csv file.below i written the xml file and xsl file
    xml file
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?xml-stylesheet type="text/xsl"?>
    <DOCUMENTS>
         <FILE>
         <DOCUMENT>
              <BUSINESS>finance</BUSINESS>
              <PROGRAM>CM</PROGRAM>
              <PROJECT>Testing Area</PROJECT>
              <NAME>121940~1.doc</NAME>
              <TEXT>SQL</TEXT>
              <LINK>http://www.sql.org/</LINK>
         </DOCUMENT>
         <DOCUMENT>
              <BUSINESS>finance</BUSINESS>
              <PROGRAM>CM</PROGRAM>
              <PROJECT>Testing Area</PROJECT>
              <NAME>121940~1.doc</NAME>
              <TEXT>Information</TEXT>
              <LINK>http://google.com/</LINK>
         </DOCUMENT>
         <DOCUMENT>
              <BUSINESS>finance</BUSINESS>
              <PROGRAM>CM</PROGRAM>
              <PROJECT>Testing Area</PROJECT>
              <NAME>121940~1.doc</NAME>
              <TEXT>Configuration</TEXT>
              <LINK>http://msdn.microsoft.com/</LINK>
         </DOCUMENT>
         </FILE>
    </DOCUMENTS>
    xsl file
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="text" indent="yes"/>
    <xsl:template match="DOCUMENTS">
    <xsl:text>Business,Program,Project,DocumentName,Textforlink,Hyperlink</xsl:text>
    <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="FILE">
    <xsl:value-of select="DOCUMENT/BUSINESS"/>
    <xsl:value-of select="','"/>
    <xsl:value-of select="DOCUMENT/PROGRAM"/>
    <xsl:value-of select="','"/>
    <xsl:value-of select="DOCUMENT/PROJECT"/>
    <xsl:value-of select="','"/>
    <xsl:value-of select="DOCUMENT/NAME"/>
    <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="DOCUMENT">
    <xsl:value-of select="','"/>
    <xsl:value-of select="','"/>
    <xsl:value-of select="','"/>
    <xsl:value-of select="','"/>
    <xsl:value-of select="TEXT"/>
    <xsl:value-of select="','"/>
    <xsl:value-of select="LINK"/>
    </xsl:template>
    </xsl:stylesheet>
    for converting to csv i am using java program.
    please go through it.

    <xsl:value-of select="','"/>That's not the correct way to output a literal comma. Just write the comma directly, or use xsl:text. And don't put in those line breaks either. You can reduce the rule for FILE to something like this:
    xsl:template match="FILE">
    <xsl:value-of select="DOCUMENT/BUSINESS"/>, <xsl:value-of select="DOCUMENT/PROGRAM"/>, <xsl:value-of select="DOCUMENT/PROJECT"/>, <xsl:value-of select="DOCUMENT/NAME"/>
    <xsl:apply-templates/>
    </xsl:template>

  • 1.4.2 - What is the correct way to format output in the java.io.PrintStream

    With Java 1.4.2:
    What is the correct way to format output in the java.io.PrintStream?
    The following is incorrect, even though it is still used in the The JavaTM Tutorial at: http://java.sun.com/docs/books/tutorial/essential/
    System.out.formatThis returns "cannot resolve the method 'format'"
    Any detailed suggestions or information is greatly appreciated.

    The following is incorrect, even though it is still
    used in the The JavaTM Tutorial at:
    http://java.sun.com/docs/books/tutorial/essential/
    The whole format thing has been introduced in 1.5. The tutorial also states it's been "updated to 1.5.".
    That's all I've got to say for I don't know how you can format a PrintWriter, let alone a PrintStream, prior to 1.5. I'm not really sure there is any way. Any "legacy way", that is. There almost certainly are third-party API which achieve similar results.

  • Problem with number-fields in PDF Output Using FOP

    When generating PDF Output using FOP as described in the utilitiy provided in the HTMLDB Studio http://htmldb.oracle.com/pls/otn/f?p=18326:44:12104450162492733947::::P44_ID:1522
    formatted numbers over 1,000 are resolved as characters (because of the comma) and are therefore right justified. This results in alignment issues for numeric columns.
    Does anyone have any ideas on how to work around this.
    Thanks,
    David

    Hello,
    Your probably going to have to edit the xslt to get the result either by stripping out the comma or by setting that column to explicitly align the way you want it.
    Carl

Maybe you are looking for

  • HT4528 Is there a way i can view old text messages that are stored on my phone

    Im trying to view text messages I have saved on my phone, but it takes so long on the phone to go back.  Is there a way to view using Itunes?

  • Adding a JButton when there's a paint method

    I'm creating a game application, sort of like a maze, and I want to add buttons to the levelOne panel to be able to move around the maze. When I add the buttons to the panel they don't appear, I assume the paint method is the reason for this. here's

  • Can't figure out how to insert an html within my template

    I've searched, but perhaps I am not using the correct terminology. I apologize if this has been addressed elsewhere. We have a vendor who is trying to mimic my webpage for our customers who sign on to her service. My problem is that I don't like havi

  • See that there is an attachment on a line item report

    Hi I wondered if it was possible to include a field on line item reports to show that a there is an attachment to be viewed.  This would be very helpful to users who would then immediately know that a particular posting has an attachment without havi

  • Alter screen field layout in MIRO - Item level

    Dear All, I would like to know whether I can change the field sequence in MIRO transaction at the item level. I want to move the Reference Doc field (GRN No)  next to the item field in MIRO and this needs to be premanent whenever I create a new invoi