12 Replies Latest reply: Oct 5, 2010 10:15 AM by 801619 RSS

    Error while calling sub template in XML Publisher

      Hi friends,
      For the Header part of my report,I create a sub template and i am trying to call it.
      I am calling the sub template using the following commands:-
      <?end call?>
      Then in the body ,I am importing this file using <?import:file:///C:\sreekanth\Header.rtf?>
      When i run the report i get the following error
      Caused by: java.io.FileNotFoundException: /C:\sreekanth\Header.rtf (No such file or directory)
      please help me .
      please tell me what is the use of "inlines" in the call to sub-template.
      while registering a sub-template it asks for a code,so should i create a new executable again?
      Also tell me what are the steps to register a sub-template ?
      I am unable to find out the reason for the error.
        • 1. Re: Error while calling sub template in XML Publisher
          Hi there,
          Tim Dexter has an excellent Blogs on subtemplates here (where you can also download example code):


          I have used the example code on the Conditional Subtemplates, found here:


          If you have an RTF file with just the following in:



          <?end template?>

          Then have an XML file with the following in:

          <?xml version="1.0"?>

          Then create another RTF file with the following in:

          <?import:file:///E:\Example Oracle Code\TCTemplates\TCTemplates.rtf?>


          (With BI Publisher, you don't even need the end call tag here) If you then load the XML in in BI Publisher and Review, you should get the word 'HELLO' displayed. With the import file string, make sure there are no blank spaces between the '\' and check by cut and pasting the directory string in Windows explorer that the RFT file is opened so you have the correct string. While developing, this import file is best on your local machine. With regard the 'inlines' syntax, I don't know - is it if you are passing in a parameter to the subtemplate?

          I hope this helps, let me know if I can assist in any further way,
          • 2. Re: Error while calling sub template in XML Publisher

            I am not sure, but my imports (when I use rtf files) look like: *<?import:file:C:/SUBTEMPLATES/SUBTEMPLATENAME.rtf?>*

            It appears to me like BIP is simply having difficulty with your path.

            • 3. Re: Error while calling sub template in XML Publisher
              Hi friends,
              I still didnot get the idea of subtemplate.
              I will let you people know what i am doing.
              I have two rtfs,one for subtemplate(Subtemplate.rtf) and the other for main template(main.rtf).

              In Subtemplate.rtf,I have the following:
              company logo
              <?end header?>

              In main.rtf I have the following:-
              In the header part, I have the following commands:-
              <?end call?>
              In the body part,I have a command to import this:-

              Now when i run this report,I get a warning saying that file is not found.
              should i register this Subtemplate?If so how?
              Assuming my main template(main.rtf) is under the Application Human Resources,tell me how should i register the subtemplate?
              Moreever while registering this subtemplate,it asks for code-which code should i give here?
              If i give the same code as my main template code ,then it says i am trying to create a duplicate?

              please let me know where i am going wrong.
              • 4. Re: Error while calling sub template in XML Publisher
                Hi there,
                I presume you are just running this from BI Publisher and not running it through the Oracle Applications, so you don't need to upload the template in the XML Publisher Administrator responsibility? Therefore, try the following:

                1) In the template: where you have:

                <?end call?>

                change this to:


                You are not passing any values to the subtemplate, so remove the 'inline' and BI Publisher can implicitley close your 'call' tag from my understanding.

                2) check that when you cut and paste the directory string 'C:\Users\qewq\Desktop\Subtemplate.rtf' in Windows explorer that the RFT file is opened so you have the correct string.

                Note that when actually running the Template in the application, you need to do the following:

                "...In this case the subtemplate is in the c:/temp directory. Very useful when you want to test. For EBS developers, remember to change this to the 'xdo:' URI format prior to deploying".

                Is that of any help?
                • 5. Re: Error while calling sub template in XML Publisher
                  I am running it through Oracle Applications.
                  So I need to upload the template right?
                  If I try to register that subtemplate,it asks for code.Which code should i give here?can i give any random code?
                  • 6. Re: Error while calling sub template in XML Publisher
                    By "code" do you mean the data define short name? If so you need 'something' so I created a generic (empty) data define and use it for all my subtemplates.

                    Then after you get them reg on Oracle Apps you call them with:

                    <!-- ********** START EBS IMPORTS **************** -->
                         <xsl:import href="xdo://SUBTEMPLATENAMEHERE.en.US"/>
                    <!-- *********** END EBS IMPORTS *************** -->

                    Now, please note if you want to run the preview locally, or use the BIP template viewer you will need to alter your import to look more like the below statement (you will need to match your local path to the subtemplate of course):

                    <!-- *********** START LOCAL IMPORTS *************
                    <xsl:import href="rtf2xsl://file_C:/SUBTEMPLATES/SUBTEMPLATENAMEHERE.rtf?"/>
                    *********** END LOCAL IMPORTS ************** -->

                    This is all covered in the Blog. I strongly suggest you read the entries on subtemplates and it should start to make more sense.

                    Good luck,
                    • 7. XML-22049: (Error) Template 'Header' invoked but not defined.
                      Hi scott,
                      I have read both the blog on sub-templates and your reply also.
                      Based on this knowledge,I tried to call the sub-template from the main template and i am getting the above-mentioned error.
                      The code in the main template is as follows:-
                      <?end call?>
                      This is in the header part of the main template.
                      In the body,I am declaring like this :- <xsl:import href="xdo://Subtemplate.en.US"/>
                      where "Subtemplate" is the .rtf file where the "Header" template is defined.
                      Please tell me where i am going wrong?
                      • 8. Re: XML-22049: (Error) Template 'Header' invoked but not defined.
                        Hi friends,
                        Finally my subtemplate issue is resolved.
                        The reason for the error was the incorrect syntax with "import" satement in the template body.
                        I found the correct syntax from the metalink document (DocId 420645.1)
                        The correct syntax to "import" a file is
                        Here PRODUCT_SHORT_NAME is the application short name in which the Subtemplate is registered.

                        Thanks a lot to you all for your prompt responses.

                        Sreekanth Munagala.
                        • 9. Re: XML-22049: (Error) Template 'Header' invoked but not defined.
                          I have the same error:

                          XML-22049: (Error) Template 'hdrall' invoked but not defined

                          only difference is that i do not use subtemplates...

                          I only have 1 template (rtf) and 1 data template both registered and linked in Oracle Applications.

                          hdrall ... don't have a template called like that...

                          Regards and thanks in advance
                          • 10. Re: XML-22049: (Error) Template 'Header' invoked but not defined.
                            Upload your template and xml here


                            we people can have look at the error :)
                            • 11. Re: XML-22049: (Error) Template 'Header' invoked but not defined.
                              Thanks for the proposal vetsrini!

                              But in the meantime the issue is resolved.
                              It hadn't anything to do with my development.

                              The client provides us with .rtf with just empty formfields and preview text. So they can shape their documents and we provide coding logic etc.
                              But the customer saved the document first as an .doc and changed it afterwards to an .rtf
                              This produces the issue.

                              I just copied everything to a new document that I directly saved as an .rtf and no issue anymore.

                              • 12. Calling subtemplate.rtf  in XML Publisher reports
                                Hi Sreekanth,

                                I am working on subtemplate in XML Publisher reports. I have subtemplate.rtf which will be called in maintemplate.rtf.

                                1.Could you tell me how to register subtemplate.rtf in oracle applications? If yes, what is code while creating data definition and template in XML PUBLISHER ADMINISTRATOR responsibility since i can't use code of maintemplate.rtf.

                                2. To import the subtemplate.rtf in maintemplate.rtf, i found the following the syntax to be used in maintemplate.rtf


                                What is TEMPLATE_CODE in above syntax? Is it the templatename of subtemplate.rtf in Oracle Applications or subtemplate.rtf name?

                                It's very helpful if you can explain to me the complete procedure?

                                Awaiting your reply!

                                Thanks in advance.