BI Publisher: Calling a subtemplate - Need correct syntax to avoid unwanted extra lines — Oracle Analytics

Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

BI Publisher: Calling a subtemplate - Need correct syntax to avoid unwanted extra lines

Received Response
102
Views
3
Comments
Mark.Thompson
Mark.Thompson Rank 6 - Analytics Lead

I am creating a BI Publisher template in Word.  Is there a way to avoid generating extra blank rows in the main template when calling a SubTemplate?

Here is my initial template:

2017-03-10_10-42-39.png

Here are the contents of the fields:

2017-03-10_10-43-07.png

Here is the output - so far, so good:

2017-03-10_10-43-26.png

Now instead of populating the three variables inside of the template, I want to put them into a SubTemplate located at c:\VarTemplate.rtf.

Here is my revised template:

2017-03-10_10-44-02.png

Here are the field contents.  Notice the change: the call to the SetVars subtemplate.

2017-03-10_10-45-08.png

Here is the code for the SetVars subtemplate.  Notice that it is identical to the code that was initially in the SetVars field in the main template.

<?xdoxslt:set_variable($_XDOCTX,'AA',1)?>

<?xdoxslt:set_variable($_XDOCTX,'BB',1)?>

<?xdoxslt:set_variable($_XDOCTX,'CC',1)?>

Here are the results:

2017-03-10_10-46-37.png

So, performing the exact same actions can generate different results if those actions are performed in a subtemplate vs. in a field in the main template.

So the question: What is the correct syntax for calling a subtemplate (obviously it isn't call@inlines:) so that we avoid generating any extra blank lines?  (Note: Removing all carriage returns in the subtemplate would still generate at least 1 extra unwanted row, and is not an option anyway, because the “real” code in the subtemplate is several dozen lines long, and I want the code to be readable, not all jumbled together in one big run-on string.)

Thanks!

Answers

  • Gbenga Ajakaye
    Gbenga Ajakaye Rank 5 - Community Champion
  • Mark.Thompson
    Mark.Thompson Rank 6 - Analytics Lead

    Thank you for the reply, Gbenga.  I have tried using the XSL subtemplate, but it appears to carry the requirement that we upload that subtemplate to the BI Catalog.  Unfortunately, my scenario is a bit different, because the end target for this template is a PeopleSoft Report Definition, attached to a PeopleSoft Query - so there is no BI Catalog involved.

    Question: Is the upload to the BI Catalog required?

    Here were my efforts at using an XSL subtemplate.  What should I correct?

    1. Created c:\XSLSubTemplate.xsl with these contents:

    <xsl:template name="Process_Punches"?>

    <?xdoxslt:set_variable($_XDOCTX,'AA',1)?>

    </xsl:template>

    2. Added this line at the top of my main template:

    <?import:xdoxsl:file:///C:\XSLSubTemplate.xsl?>

    3. In my main template, added this call to the subtemplate:

    <xsl:call-template name="Process_Punches"?></xsl:call-template>

    4. Ran the main template, got this error:

    ConfFile: C:\Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdoconfig.xml

    Font Dir: C:\Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\fonts

    Run XDO Start

    Template: C:\Users\Administrator\Desktop\BI Pub\PubTest.rtf

    RTFProcessor setLocale: en-us

    FOProcessor setData: C:\Users\Administrator\Desktop\BI Pub\Test_Punch_Data_255_Rows.xml

    FOProcessor setLocale: en-us

    java.lang.reflect.InvocationTargetException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at oracle.apps.xdo.common.xml.XSLT10gR1.invokeNewXSLStylesheet(Unknown Source)

        at oracle.apps.xdo.common.xml.XSLT10gR1.transform(Unknown Source)

        at oracle.apps.xdo.common.xml.XSLTWrapper.transform(Unknown Source)

        at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)

        at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(Unknown Source)

        at oracle.apps.xdo.template.FOProcessor.createFO(Unknown Source)

        at oracle.apps.xdo.template.FOProcessor.generate(Unknown Source)

        at RTF2PDF.runRTFto(RTF2PDF.java:629)

        at RTF2PDF.runXDO(RTF2PDF.java:442)

        at RTF2PDF.main(RTF2PDF.java:289)

    Caused by: java.util.EmptyStackException

        at oracle.xdo.parser.v2.XSLProcessor.reportException(XSLProcessor.java:806)

        at oracle.xdo.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:571)

        ... 14 more

    Any thoughts?

  • Mark.Thompson
    Mark.Thompson Rank 6 - Analytics Lead

    I believe I figured out an answer - and it was totally by accident and totally unexpected.  Here are the very simple steps that you can follow to create a subtemplate that will not return extra, unwanted blank rows.

    Main template:

    2017-03-10_10-42-39.png

    Here are the contents of the fields in the main template:

    2017-03-10_10-45-08.png

    pastedImage_0.png

    One additional observation: I have not had much luck pasting into this document.  As long as I type everything from scratch, the template is fine.  But if I copy/paste into the subtemplate, it can get messed up.  Until I can research further, NEVER paste anything into the subtemplate.  And for good measure, always make a backup copy of the subtemplate before you start messing with it.

    Please don't take anything in this post as gospel truth.  I only just discovered this "feature" today.  I've not tested this with the creation and return of any type of formatted output by the subtemplate file.  I've only experimented with the metadata instructions specifically mentioned above.

    So... Word-born vs. Notepad-born can make a tremendous difference.  Who knew?  I hope you find this useful.