XSLT stylesheet template for Endeca Records

Endeca Forge provides a Record Adapter which can load XML data, transformed (if required) to Endeca's XML record format by an XML Stylesheet Template (XSLT). This provides a way of getting XML into Endeca with a minimum of fuss, for data analysis, PoCs and for modest amounts of XML data in production applications.
There was an XSLT template posted to Endeca Eden prior to the acquisition. The thread is still available at:
http://eden.endeca.com/web/eden/forums/message_boards/message/99120
Does anyone have a copy of the template?
TG

Hi TG,
Template XSLT below. Its main feature is that it attempts to be XSLT-agnostic, other than identification of the start-record element/x-path. It could be optimized for specific XML structures, or modified to support more complex XML data.
Note also the remarks about XSLT and larger XML data - as your XML source data gets larger, XSLT will become less attractive, and you'll want to implement a streaming or pull-parser approach (SAX, StAX).
Best
Brett
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2012 Oracle, Inc. All Rights Reserved. -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes" doctype-system="records.dtd" />
     <!--
          ========== About this stylesheet ==========
          This is a generic stylesheet for transforming an XML file into the XML record format accepted by Endeca Forge.
          The stylesheet is designed to be reasonably agnostic about the source XML format: the main configuration required is to identify
          one or more repeating record elements in the source XML.  The stylesheet creates the root RECORDS element, enclosing one RECORD element for each
          repeating element.
          Each RECORD element is then assigned any number of PROP name-value pairs created for each property, with each PROP containing
          a NAME attribute and a PVAL.  The stylesheet effectively "flattens" the XML into a RECORD, recursively fetching sub-elements and creating
          properties named according to the hierarchical path (think XPath).
          ========== Stylesheet configuration ==========
          Add your base source repeating elements as an xpath selector at ADD RECORD SELECTORS HERE below.
          The default example in the template is "item", which suites an RSS 2.0 feed.
          By default, the template will use full path property names.  To change to simple property names, change the variable
          use-simple-prop-names below to true().
          You can also change the path dividers used in full property names - see path-divider and attribute-divider variables below.
          ========== Examples ==========
          The first example used is an RSS 2.0 feed (note that there are other Endeca adapters for this type of data).
          Using full property names, this will produce records with the following properties:
          rss_channel_item_title
          rss_channel_item_description
          rss_channel_item_link
          rss_channel_item_guid_@isPermaLink
          and so on.  With simple prop names, only the last part of the name is used (after the last _ or @).
          The second example (sample.xml and sample_records.xml) shows how nested repeating elements within a record are folded-down to
          a multi-value property.
     -->
     <!-- change select to true() to use simple prop names -->
     <xsl:variable name="use-simple-prop-names" select="false()" />
     <xsl:variable name="path-divider">
          <xsl:text>_</xsl:text>
     </xsl:variable>
     <xsl:variable name="attribute-divider">
          <xsl:text>_@</xsl:text>
     </xsl:variable>
     <xsl:template match="/">
          <xsl:element name="RECORDS">
               <!-- apply templates for each "repeating element" representing a single record -->
               <!-- ADD RECORD SELECTORS HERE -->
               <xsl:apply-templates select="//item" />
          </xsl:element>
     </xsl:template>
     <!-- one template with RECORD element for each template type applied above -->
     <xsl:template match="item">
          <xsl:element name="RECORD">
               <xsl:call-template name="leaves-auto-subpaths" />
          </xsl:element>
     </xsl:template>
    <!-- calls the prop template for each leaf -->
    <xsl:template name="leaves-auto-subpaths">
        <!-- select all attributes-->
        <xsl:for-each select="@*">
            <xsl:call-template name="prop" />
        </xsl:for-each>
        <!-- select all leaf nodes -->
        <xsl:for-each select="*[not(*) and . != '']">
            <xsl:call-template name="prop" />
        </xsl:for-each>
        <!-- auto recurse subpaths -->
        <xsl:for-each select="*[*]|*[@*]">
            <xsl:call-template name="leaves-auto-subpaths" />
        </xsl:for-each>
    </xsl:template>
    <!-- creates the PROP element and calls prop-name and prop-pval -->
    <xsl:template name="prop">
        <xsl:element name="PROP">
             <xsl:if test="$use-simple-prop-names">
                  <xsl:call-template name="prop-name-simple" />
             </xsl:if>
             <xsl:if test="not($use-simple-prop-names)">
                  <xsl:call-template name="prop-name-full" />
             </xsl:if>
            <xsl:call-template name="prop-pval" />                 
        </xsl:element>
    </xsl:template>
    <!-- creates the NAME element -->
    <xsl:template name="prop-name-simple">
        <xsl:attribute name="NAME">
            <xsl:value-of select="name()" />
        </xsl:attribute>
    </xsl:template>
    <!-- creates the NAME attribute -->
    <xsl:template name="prop-name-full">
        <xsl:attribute name="NAME">
             <!-- walk from root to current node, print name and underscore  -->
            <xsl:for-each select="ancestor-or-self::*">
                <xsl:value-of select="name()" />
                <xsl:if test="position() != last()">
                    <xsl:value-of select="$path-divider" />
                </xsl:if>
            </xsl:for-each>
            <!-- pick up attributes -->
            <xsl:if test="not(namespace::*)">
                <xsl:value-of select="$attribute-divider" />
                <xsl:value-of select="name()" />
            </xsl:if>
        </xsl:attribute>
    </xsl:template>
    <!-- creates the PVAL element -->  
    <xsl:template name="prop-pval">
        <xsl:element name="PVAL">
            <xsl:value-of select="." />
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>

Similar Messages

  • OPM gives error when trying to use XSLT stylesheet

    Hi,
    I am trying use a simple XSLT stylesheet into an OPM project and see the result in the web determination screen.But when ever i am clicking on the link that is created when i compile the project with the XSL file, i am getting the error
    "An error occurred trying to process your request.
    This error has been logged and is available in the application logs.
    For support and assistance please contact [email protected]"
    I have kept the XSL file inside the "templates" folder in "include" folder.
    I am using a very simple one i.e
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0" >
    <xsl:output method="html"/>
    </xsl:stylesheet>
    How do I find what the error is and what do I need to do to solve this?
    Thanks and regards
    Sagnik

    Yes, now that above issue is solved and now when I click on the "HTML" or "PDF" link, I think some file is being generated but not properly.
    For HTML, I am getting blank page error and for PDF I am getting "file is damaged" error.May be, the xslt stylesheet that I am using is wrong, but I am absolutley stuck with this. I have tried many different formats of xlst stylesheets, but none seem to be working.
    pasting the two xslts below:
    *<?xml version="1.0" encoding="UTF-8" ?>*
    *<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">*
    *<xsl:output method="html"/>*
    *<xsl:template match="/">*
    *<xsl:apply-templates/>*
    *</xsl:template>*
    *<html>*
    *<body>*
    *<xsl:template match="session">*
    *<session><xsl:apply-templates/></session>*
    *</xsl:template>*
    *<xsl:template match="entity name">*
    *<entity-name align="center"><xsl:apply-templates/></entity-name>*
    *</xsl:template>*
    *<xsl:template match="instance label">*
    *<instance-label align="center"><xsl:apply-templates/></instance-label>*
    *</xsl:template>*
    *<xsl:template match="attribute id">*
    *<attribute-id><xsl:apply-templates/></attribute-id>*
    *</xsl:template>*
    *<xsl:template match="date-val">*
    *<date-val><xsl:apply-templates/></date-val>*
    *</xsl:template>*
    *<xsl:template match="text-val">*
    *<text-val><xsl:apply-templates/></text-val>*
    *</xsl:template>*
    *<xsl:template match="unknown-val">*
    *<unknown-val><xsl:apply-templates/></unknown-val>*
    *</html>*
    *</body>*
    *</xsl:template>*
    *</xsl:stylesheet>*
    and
    *<?xml version="1.0" encoding="UTF-8" ?>*
    *<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">*
    *<xsl:output method="html"/>*
    *<xsl:template match="/">*
    *<html>*
    *<body>*
    *<xsl:template match="session">*
    *<session><xsl:apply-templates/></session>*
    *</xsl:template>*
    *<enityName>*
    *<xsl:for-each select="entity name">*
    *<instancelabel>*
    *<xsl:for-each select="instance label">*
    *<attribute-id>*
    *<xsl:for-each select="attribute id">*
    *<text-val>*
    *<xsl:value-of select="text-val"/>*
    *</text-val>*
    *<date-val>*
    *<xsl:value-of select="date-val"/>*
    *</date-val>*
    *</xsl:for-each>*
    *</attribute-id>*
    *</xsl:for-each>*
    *</instancelabel>*
    *</xsl:for-each>*
    *</enityName>*
    *</body>*
    *</html>*
    *</xsl:template>*
    *</xsl:stylesheet>*
    also pasting the source xml file I am trying to convert.
    - <session xmlns="http://oracle.com/determinations/engine/relational/sessiondata/10.0" sessionDateTime="2010-12-17T11:34:08" locale="en-US" rulebase="Barclay_2910" rulebase-build="2010-12-17 06:04:02Z">
    - <entity name="global">
    - <instance label="global">
    - <attribute id="S_Other_Type_of_Business1">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Nature_of_Business">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="N_Desired_Review_Period">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_I_Confirm">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_new_investors_ID_Vd">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Address">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="N_Total_Amount_of_Capital_Invested">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_State_Business_use_Trading_name1">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Correspondence_Postcode">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Country">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_BTA_Code1">
    *<text-val>Central Government</text-val>*
    *</attribute>*
    - <attribute id="S_Correspondence_Address">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="N_Total_Amount_Capital_Invested_non_Corporate">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Business_Organisation">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_State_Business_use_Trading_name">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Business_Organisation1">
    *<text-val>1</text-val>*
    *</attribute>*
    - <attribute id="S_Date_Established1">
    *<date-val>2010-01-01</date-val>*
    *</attribute>*
    - <attribute id="S_Telephone_Number">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Date_of_Incorporation1">
    *<uncertain-val />*
    *</attribute>*
    - <attribute id="S_Date_of_Incorporation">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Postcode">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Start_Up_Type_Non_Corporate">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Previous_registered_names">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Other_Investments_non_corporate">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Registered_Number">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="b8@Properties_PropBkACC_xsrc">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Registered_Number1">
    *<text-val />*
    *</attribute>*
    - <attribute id="b6@Properties_PropBkACC_xsrc">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Business_use_Trading_name1">
    *<text-val>Yes</text-val>*
    *</attribute>*
    - <attribute id="S_Registered_address_Main_Trading">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_select_the_high_risk_industry_operated1">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Start_Up_Type">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Priority1">
    *<text-val>Standard</text-val>*
    *</attribute>*
    - <attribute id="S_Correspondence_address_same_Main_Trading">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Additional_Source_Capital">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Previous_Sort_Code">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Source_of_funds">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Choose_Start_Up1">
    *<text-val>Start Up/New Entity/Businesses</text-val>*
    *</attribute>*
    - <attribute id="S_Registered_Country">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Fax_Number">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Contributer">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_business_organisations_annual_turnover1">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Previous_Account_number_Roll_Number">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Previous_registered_names1">
    *<text-val />*
    *</attribute>*
    - <attribute id="b9@Rules_startuprule_doc">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_CIS_Record1">
    *<text-val>Yes</text-val>*
    *</attribute>*
    - <attribute id="S_Employees_Members1">
    *<text-val>1-9</text-val>*
    *</attribute>*
    - <attribute id="S_shareholders_Contributors">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Business_operate_high_risk_industry">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="b7@Properties_PropBkACC_xsrc">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_select_the_high_risk_industry_operated">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_business_organisations_annual_turnover">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Registered_Postcode">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Nature_of_Business1">
    *<text-val />*
    *</attribute>*
    - <attribute id="S_Country_of_Incorporation1">
    *<text-val>1</text-val>*
    *</attribute>*
    - <attribute id="N_issued_share_capital_company">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Correspondence_Country">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Type_of_Business1">
    *<text-val>Sole Trader</text-val>*
    *</attribute>*
    - <attribute id="S_Web_Address">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Registration_Number1">
    *<text-val />*
    *</attribute>*
    - <attribute id="S_Business_operate_high_risk_industry1">
    *<text-val>Yes</text-val>*
    *</attribute>*
    - <attribute id="S_Additional_Source_Capital1">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="Source_of_funds_non_Corporate">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Country_of_Incorporation">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_if_registered_address">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Date_Established">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Registration_Number">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_ID_VD">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_I_confirm_form_287">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Other_Investments">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_I_Confirm1">
    *<text-val>Yes</text-val>*
    *</attribute>*
    - <attribute id="S_Date_Form_Lodged">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Registered_Address">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="S_Other_Type_of_Business">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="N_start_up_capital_business">
    *<unknown-val />*
    *</attribute>*
    - <attribute id="N_Approx_transferring_balance">
    *<unknown-val />*
    *</attribute>*
    *</instance>*
    *</entity>*
    *</session>*
    Edited by: Sagnik on Dec 21, 2010 12:06 AM

  • Can I use some JavaScript in an XSLT stylesheet?

    I have two related (I think) problems.
    I am using Dreamweaver CS4 in Windows XP, Service Pack 3.
    I have created an XSLT stylesheet that transforms a simple XML file into HTML. I have a very short JavaScript that writes the day's date into the document. It is a script that I have used in many other HTML pages. The XSLT stylesheet also has a Spry widget, an accordion, in one of its DIV elements. Originally, I developed the accordion as part of a Dreamweaver template, and it works fine there. I cannot get the scripts to work completely in Firefox and Internet Explorer.
    If I just link in the external JavaScript files, the XML document displays correctly in both browsers. Note that MY external JavaScript file is the definition of one function, today(). The other JavaScript file is the Spry js file for the accordion widget. Of course the widget displays, but is not functional.
    If I add the script to display the date (document.write(today()); document.close();) in one of the DIVs, Internet Explorer(7) displays the date correctly in the correct location AND displays all the other content correctly, including the accordion, which of course is not functional. However, FireFox (latest version) displays ONLY the date in a white background and NOTHING else, such as background image, other DIVs with content, the accordion widget, etc.
    If I add the script to instantiate the accordion widget, FireFox displays the date and nothing else, as before. Internet Explorer displays the date, the other content, and the accordion widget, as before, but the widget is still not functional, that is, the accordion does not close or open when the panels are clicked.
    So, do I have to be extra careful on where I place scripts in an XSLT? Or is there some reason why scripts in an XSLT file do not work? It seems that once the browser transforms the XML file into HTML, which includes the scripts, it should display correctly.
    Thanks,
    Van

    Not sure what you mean by a CDATA section. But here is the XSLT file showing the template for the root element. The script is included using a <script> element, inserted in the <head> element. Should it be some place else?
    <?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="Trial procedure.xml" -->
    <!DOCTYPE xsl:stylesheet  [
        <!ENTITY nbsp   "&#160;">
        <!ENTITY copy   "&#169;">
        <!ENTITY reg    "&#174;">
        <!ENTITY trade  "&#8482;">
        <!ENTITY mdash  "&#8212;">
        <!ENTITY ldquo  "&#8220;">
        <!ENTITY rdquo  "&#8221;">
        <!ENTITY pound  "&#163;">
        <!ENTITY yen    "&#165;">
        <!ENTITY euro   "&#8364;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title><xsl:value-of select="MovexUser/Title"/></title>
    <script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
    <link href="resources/navigatorSpryAccordion.css" rel="stylesheet" type="text/css" />
    </head>
    <body id="body">
    --- The JavaScript funtions are called inside DIV elements here. ---
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  • Calling java instance methods in XSLT stylesheet

    HI
    I know this has been answered in this forum but I cnanot get it to work.
    Before calling the transform() method on my transformer instance I do the following
    transformer.setParameter( "Confirm", confirm)confim is an instance of one of my own classes. I want to get the
    XSLT stylesheet to call a method on this object. The method sig is
    public void setTitle(String title)Accordingly in my stylesheet I do the following
    <xsl:param name="Confirm"/>having already declared the java namespace in my stylesheet element as xmlns:java="java", and later on call the setTitle method
    <xsl:value-of select="java:setTitle($Confirm,$Title)/>where $Title is another var generated in the XSLT.
    This should work, right? Well I get an error
    'The first argument to the non-static Java function 'setTitle' is not a valid object reference.'But it is as I can do this
    <xsl:value-of select="$Confirm"/>Thanks
    Mark

    Hi !
    I've being trying to use a java class into xsl but without success.
    If anybody can help me to no how do I have to organize the files (.class, .xsl)????
    My organization is like this
    c:
    WEBAPP
    WEB-INF (here I have the .xml and .xsl)
    classes
    com
    example (here I have the .class)
    And I use it as follows:
    --------------------------------------xslextension_prueba.XSL------------------ ---------------------------
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:java="java"
    extension-element-prefixes="java"
    version="1.0">
    <xsl:output method="html"/>
    <xsl:template match="/">
    <html>
    <body bgcolor="#FFFFFF">
    <h2>The smoking calendar</h2>
    <h3>
    <xsl:value-of select="java:Date.new()"/>
    </h3>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    --------------------------------------------XML-------------------------------- ----
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="xslextension_prueba.xsl"?>
    <articles>
    <article>
    <title>Using Web Services</title>
    <author>T. Cowan</author>
    <date>11/30/01</date>
    <text>
    content of article.
    </text>
    </article>
    <article>
    <title>Java May Be Just a Fad</title>
    <author>J. Burke</author>
    <date>08/15/95</date>
    <text>
    content of article.
    </text>
    </article>
    </articles>
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!AND I GET THIS ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    E The URI java does not identify an external Java class
    THANKS FOR YOUR HELP......

  • Default XSLT Stylesheet to transform BW XML Data?

    I'm currently working on a deafult XSLT Stylesheet to convert a BW XML Query Result Set into an html grid.
    [code]
    <!--
    #==========================================================================
    XSL Transformation that displays
    Template Properties, List of Data Providers and List of Items
    #==========================================================================
    -->
    <xml id="xsl_transform_1">
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:variable name="header">
    <tr bgcolor="white"> <xsl:for-each select="//RRWS_SX_TUPLE[1]/*">
      <td>
      <xsl:value-of select="local-name()"/>
      </td>
    </xsl:for-each>
    </tr>
    </xsl:variable>
    <xsl:template match="/">
    <table bgcolor="gold" border="1">
    TESTVALUE -
    <tr>
      <xsl:copy-of select="$header" /> <xsl:apply-templates />
    </tr>
    <xsl:for-each select="//RRWS_SX_TUPLE">
          <tr>
            <td><xsl:value-of select="TUPLE_ORDINAL"/></td>
              <xsl:for-each select="//RRWS_S_CELL">           
              <td><xsl:value-of select="CELL_ORDINAL"></td>
              </xsl:for-each>
            <td><xsl:value-of select="TUPLE_ORDINAL"/></td>
            <td><xsl:value-of select="CHANM"/></td>
            <td><xsl:value-of select="CAPTION"/></td>
            <td><xsl:value-of select="CHAVL"/></td>
            <td><xsl:value-of select="CHAVL_EXT"/></td>
            <td><xsl:value-of select="NIOBJNM"/></td>
            <td><xsl:value-of select="TLEVEL"/></td>
            <td><xsl:value-of select="DRILLSTATE"/></td>
            <td><xsl:value-of select="OPT"/></td>
            <td><xsl:value-of select="SIGN"/></td>                    
            <td><xsl:value-of select="ATTRIBUTES"/></td>     
          </tr>
    <xsl:for-each select="//RRWS_S_CELL">
         <tr>     
            <td><xsl:value-of select="CELL_ORDINAL"/></td> 
            <td><xsl:value-of select="VALUE"/></td>            
            <td><xsl:value-of select="FORMATTED_VALUE"/></td> 
            <td><xsl:value-of select="VALUE_TYPE"/></td> 
            <td><xsl:value-of select="CURRENCY"/></td> 
            <td><xsl:value-of select="UNIT"/></td> 
            <td><xsl:value-of select="MWKZ"/></td> 
            <td><xsl:value-of select="NUM_SCALE"/></td> 
            <td><xsl:value-of select="NUM_PREC"/></td> 
            <td><xsl:value-of select="CELL_STATUS"/></td> 
            <td><xsl:value-of select="BACK_COLOR"/></td> 
         </tr>
    </xsl:for-each>
    </table>
    </xsl:template>
    <xsl:template match="RRWS_S_CELL/*">
    <td> <xsl:value-of select="." /> </td>
    </xsl:template></xsl:stylesheet>
    </xml>
    [/code]
    I've started this, but I need to join the top tree with the bottom. Right now I'm just flattening the tree. Does anyone know if any work has been done in this area? I'm looking to create these XSLT Transforms. Also, I'd like to create generic javascript functions that I can use as an include, such as
    function join_BW_Table(table1, table2, fieldtojoin, typeofjoin)
    This would allow anyone to generically combine BW Data from multiple sources all on the FrontEnd and render it all as an html table. My ultimate goal would be have all this in includes and available for all BW Reporting. Anyone have any thoughts on:
    1. Has this been done before?
    2. If it hasn't, anyone have comments on how I can combine the 2 tables that I'm rendering with the attached XSLT transform?
    I'm running these transforms via a javscript function on the load of the html page.
    Prakash

    Prakash,
    did you ever compile the Stylesheet?  I am looking for an alternative way to format the pre-compiled XML file from the Report Designer.  The more complex my report is, the less robust the application becomes.
    Your insight would be greatly appreciated.
    Thank you

  • Use Java to process the XSLT stylesheet

    Background:-
    I used Java to design a very simple Interface, which was composed of two components, one is an editable comboBox, the other is a button. What I want to achieve is selecting the value in the combobox and clicking the button, then it will achieve the relevant transformation process against the value selected from the comboBox.
    Implementation:-
    The transformation process is to extracting a set of information about a certain bird from an XML document, which contains many birds' information, to form a new XML document of one bird. The bird that I want to transform is listed in the comboBox and can be selected there. I use the Java to control the transformation process. My design is: I use Java programme to read the selected comboBox's value (bird name) and pass this value to the XSLT stylesheet, which is used to transform the XML document to a new XML document. What I have implemented: The Java programme has successfully controlled the transformation process, but I have defined in the XSLT stylesheet the bird name in advance. So the transformation is limited.
    What I want:-
    What I want is the transformation process will be carried out based on the value (bird name) read from the comboBox on the interface. And I hope to use Java to achieve this design!
    XSLT stylesheet code:-
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="node()">
         <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="class[own-slots/own-slot/entry/value = 'Barn_swallow']">
         <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:stylesheet> I am very appreciated if you can provide me some helps kindly!
    Thanks a lot! Waiting for your nice suggestions!
    David

    I mean, you can find the bird name(Barn_swallow) in my
    attached XSLT stylesheet code. This name was actually
    defined in advance. What I want to perform now is to
    use the Java program to get the bird name from the
    comboBox (you have gave out the method) and pass it to
    the XSLT(actually needed to implement by Java), then
    continue to use the Java programe to achieve the
    transformation process (this step, I think, has been
    achieved.) Obviously, how to perform the second step
    "pass it to the XSLT" is the current task!What can you do already? Can you get a Transformer object from a TransformerFactory? If so, then simply call its setParameter("bird", "Barn Swallow") method. You'll have to declare a top-level xsl:param element whose name is "bird" in your XSL transformation, which you can then use as if it were a variable.

  • Can I have JavaScript in an XSLT stylesheet?

    I posted this first on the Dreamweaver forum, and it was suggested that I post here instead...
    I have two related (I think) problems.
    I am using Dreamweaver CS4 in Windows XP, Service Pack 3.
    I have created an XSLT stylesheet that transforms a simple XML file into HTML. I have a very short JavaScript that writes the day's date into the document. It is a script that I have used in many other HTML pages. The XSLT stylesheet also has a Spry widget, an accordion, in one of its DIV elements. Originally, I developed the accordion as part of a Dreamweaver template, and it works fine there. I cannot get the scripts to work completely in Firefox and Internet Explorer.
    If I just link in the external JavaScript files, the XML document displays correctly in both browsers. Note that MY external JavaScript file is the definition of one function, today(). The other JavaScript file is the Spry js file for the accordion widget. Of course the widget displays, but is not functional.
    If I add the script to display the date (document.write(today()); document.close();) in one of the DIVs, Internet Explorer(7) displays the date correctly in the correct location AND displays all the other content correctly, including the accordion, which of course is not functional. However, FireFox (latest version) displays ONLY the date in a white background and NOTHING else, such as background image, other DIVs with content, the accordion widget, etc.
    If I add the script to instantiate the accordion widget, FireFox displays the date and nothing else, as before. Internet Explorer displays the date, the other content, and the accordion widget, as before, but the widget is still not functional, that is, the accordion does not close or open when the panels are clicked.
    So, do I have to be extra careful on where I place scripts in an XSLT? Or is there some reason why scripts in an XSLT file do not work? It seems that once the browser transforms the XML file into HTML, which includes the scripts, it should display correctly.
    For now, I am trying to create a whole page XSLT, not fragments.
    Thanks,
    Van

    Not sure what you mean by a CDATA section. But here is the XSLT file showing the template for the root element. The script is included using a <script> element, inserted in the <head> element. Should it be some place else?
    <?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="Trial procedure.xml" -->
    <!DOCTYPE xsl:stylesheet  [
        <!ENTITY nbsp   "&#160;">
        <!ENTITY copy   "&#169;">
        <!ENTITY reg    "&#174;">
        <!ENTITY trade  "&#8482;">
        <!ENTITY mdash  "&#8212;">
        <!ENTITY ldquo  "&#8220;">
        <!ENTITY rdquo  "&#8221;">
        <!ENTITY pound  "&#163;">
        <!ENTITY yen    "&#165;">
        <!ENTITY euro   "&#8364;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title><xsl:value-of select="MovexUser/Title"/></title>
    <script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
    <link href="resources/navigatorSpryAccordion.css" rel="stylesheet" type="text/css" />
    </head>
    <body id="body">
    --- The JavaScript funtions are called inside DIV elements here. ---
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  • Pass object to xslt stylesheet and invoke its methods

    I'd like to pass an external created object to a xslt stylesheet to dynamically modify the xslt file at run time. After searching around for weeks, I'm really desperate.
    I used Xalan transformer's method setParameter(name, obj) to initialize a variable in xslt file with this object. Then the object's method was invoked.
    The class that I want to invoke the method:
    class test{
    private String testString = "abc";
    public String valueOf(){
    return testString;
    xslt file:
    <xsl:param name="myType"></xsl:param>
    <<xsl:variable name="new-pop"
    select="my-class:valueOf($myType)">
    Any help is greatly appreciated.
    Thank you.
    Message was edited by:
    Orbital
    Message was edited by:
    Orbital

    Thank sabre. I have looked through your link.
    The problem is for all the info I knew, we can only
    create a new object inside the stylesheet using new()
    and then invoke this particular object's instance
    method.
    However, I want to pass an already created java
    object into the stylesheet and then invoke its
    method.
    Xalan seems to not allow this. I have tried to pass
    an object as the parameter of
    transformer.setParameter(name, object) but it doesn't
    work.
    Any one know what 3rd party transformer that allow to
    pass object directly into xslt?setParameter will work... in your XSL, you should have
    <xsl:param name="myParam" />set the parameter in your transformer like what you had in your post...
    In your XSL header, you must declare the your Java object namespace and path, such as:
    xml:myJavaObject= "com.MyCompany.MyJavaObject"then in your template or anywhere that you want to use your object, you should have:
    <xsl:variable name="runningMyMethod" select="myJavaObject:myJavaMethod($myParam)" />The XSL will treat $myParam as the instance object, if there is any other method parameters needed to be passed in do:
    <xsl:variable name="runningMyMethod" select="myJavaObject:myJavaMethod($myParam, 'blah', 'blah')" />Good luck.

  • Problem in creating template for the accounting transactions

    Hi,
    suppose for making an entry through fb50 we have to enter g/l a/c no. in that particular field but if some one does not want his end user to make an entry to this field other than putting an entry through his end user he wants system to take the required g/l a/c by default is it possible by creating template for that particular postings? if yes how to generate the template? i have tried to make a template through the recurring entries but not succeeded in that , so please help me.
    Thanking You
    santosh rothe
    9421542585

    You can create a template with a particular account code string from within FB50.
    Make sure you have the tree turned on (Tree On/ Tree Off button toggles display).
    Once you have entered the standard coding, right click on the Account Assignment Template folder to get a popup menu. Select "Save Account Assignment Template". A dialog box will ask you to name the template.
    You can then instruct users to use this template to record this type of transaction.
    However, this does not prevent the user from doing direct entry or changing account code strings. If you have a situation where for a particular combination of accounting elements, whether header or detail, for which the GL should always be a particular value, you can create a substitution rule in IMG which will automatically populate the GL field with the specific GL account value. The IMG transaction is OBBH.

  • Endeca Record spec creation

    Hello everyone,
    Currently our pipeline has 2 input records. 1. ITEM 2. PRICE. For each item in ITEM file, there may be multiple price records in PRICE file. There can be a situation where a particular item does not have any price at all (Expired Items). we are doing LEFT JOIN between ITEM and PRICE.
    Now the problem is, we have created a column in PRICE file called "rec_spec" and this acts as a record spec in our pipeline as this is unique in PRICE file. But when we left join it with ITEM records, for all the items which has price will have record spec and expired items will not have record spec. This is creating a huge amount of logs in dgidx.log file as the warning for the records which does not have record spec. Our client wants to get rid of those warning messages from log file. How can I go ahead with this? Is there a way in which Endeca creates a unique record spec for all the records after left join? Please help.
    Also, we can't create a record spec only in ITEM file as after left join with PRICE records multiple records may contain same record spec and baseline_update will throw an error.
    Thanks in advance,
    Sav

    Hi Sav,
    As you've identified, the RecSpec has to be unique - and there are two ways you can go about this.
    #1 - Allow DGIDX to automatically create it; if you don't specify a property to act as the RecSpec and provide it with any values, then it will operate similar to a standard database and create it's own index.  This is not the recommended method though, as it prevents you from being able to conduct partial updates - if you can't re-create the key used, then how can you update the record?
    #2 - Create your own RecSpec, as you're doing right now with the PRICE file in the pipeline.  As you've identified though, if you have an empty RecSpec or duplicate, an error is generated.
    This is a common problem with the scenario you described, since when there isn't a match to the left of the join and results in an empty key.  I would suggest using a manipulator component, such as a Record Manipulator, following the join to create the RecSpec. There's no need to only use a source field, in fact when using multiple data sets (such as products, how-to's, and articles) we re-create our RecSpecs afterwards.
    My suggestion would be to drop a manipulator after the join with the following behaviour:
    Retrieve a unique value from the ITEM file, such as Item_ID, Product_ID, etc., as the first part of the key.
    If there is a key present from the PRICE file (showing that this is not an expired product), append the additional key (rec_spec) from it onto the ITEM identifier
    Optionally, you could append an "_EXPIRED" onto the item ID if there isn't a match with PRICE
    That way every item will have a unique RecSpec, which could be recreated if required.

  • Template for Customized Reports

    Where will I find templates for customizing forms and reports in OraApps11i.

    Naren,
          Another option is, if you want to FORCE global stylesheet for ALL users.  You can update the WebIDefaultStyleSheet.css located in  \SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\images\ folder.
    Regards,
    Ajay

  • XSQL/XSL help (iPlanet): Error processing XSLT stylesheet

    hello-
    i am running XSQL and XSL pages on an iPlanet web server and i am receiving the following error:
    XSQL-011: Error processing XSLT stylesheet: /xslt/page/xsl_page.xsl
    XSL-1002: Error while processing include XSL file (\xslt\util\other_xsl.xsl (The system cannot find the path specified)).
    here's the deal: other_xsl.xsl (the one it says it can't find) is there in the right place, but the web server is not looking from the document root (which IS set correctly on the web server). it is looking for the file starting at the current directory.
    for example, the server is processing /xslt/page/xsl_page.xsl. it is then looking for the include file using this path: /xslt/page/XSLT/UTIL/other_xsl.xsl --- instead of the correct /xslt/util/other_xsl.xsl.
    the include statement uses the full path starting from the web root (<xsl:include href="/xslt/util/other_xsl.xsl"/>)
    any help would be appreciated.

    thanks for the response. the /xslt/util directory is browsable by the web server, and using relative paths does work (that is one of the ways i discovered what was going on in the first place), but i am rebuilding a machine and redeploying an exisiting application-- the intention is to not re-write any code.
    the part that is most confusing is that the current code/directory structure works on the current box, but not on my rebuilt box. i have gone through every config file with a fine tooth comb. it appears that the current box and my build are set up exactly the same-- but, like i said, on one it reads the include-path from the document root, on the other from the current directory.
    so confusing.

  • Template for ALV

    anyone have a template for ALV with FM reuse_alv_grid
    PLS////

    Hope you mean to ask a sample program for ALV GRID report
    Here you go.
    RANGES: r_fiscal_period     FOR  s600-spmon.
    DATA:   gt_fieldcat         TYPE slis_t_fieldcat_alv,
            gt_fcat             TYPE slis_t_fieldcat_alv,
            gs_fieldcat         LIKE LINE OF gt_fieldcat,
            gs_fcat             LIKE LINE OF gt_fcat,
            gt_fldcat           TYPE lvc_t_fcat,
            gs_fldcat           TYPE lvc_s_fcat,
            gt_layout           TYPE slis_layout_alv,
            gt_events           TYPE slis_t_event,
            gt_list_top_of_page TYPE slis_t_listheader,
            gv_repid            LIKE sy-repid,
            gv_beg_period       LIKE /irm/s_ipcisel-etprd,
            gv_line(2)          TYPE c.
    DATA:   gv_year(4)          TYPE c,
            gv_month(2)         TYPE c,
            gv_count            TYPE i,
            gv_total            TYPE mc_umnetwr,
            gv_num_lines        TYPE i,
            gv_text1(100)       TYPE c.
    DATA:   gt_dyn_table TYPE REF TO data,
            gs_dyn_line  TYPE REF TO data.
    FIELD-SYMBOLS: <fs_quota>   TYPE STANDARD TABLE,
                   <fs_amount>,
                   <fs_quota_wa>.
    *                C O N S T A N T S
    CONSTANTS: c_600                  TYPE tabname VALUE 'S600',
               c_601                  TYPE tabname VALUE 'S601',
               c_602                  TYPE tabname VALUE 'S602',
               c_603                  TYPE tabname VALUE 'S603',
               c_a00                  TYPE vrsio   VALUE 'A00',
               c_01(2)                TYPE c       VALUE '01',
               c_formname_top_of_page TYPE slis_formname
                                      VALUE 'TOP_OF_PAGE'.
    *   I N T E R N A L  T A B L E S     &      W O R K  A R E A S
    *structure to hold the quotas
    TYPES: BEGIN OF ty_quotas,
             umnetwr   TYPE mc_umnetwr,                  "Net Value
           END OF ty_quotas.
    *list of months
    DATA: BEGIN OF gs_months,
            field_1      LIKE s600-umnetwr,
            field_2      LIKE s600-umnetwr,
            field_3      LIKE s600-umnetwr,
            field_4      LIKE s600-umnetwr,
            field_5      LIKE s600-umnetwr,
            field_6      LIKE s600-umnetwr,
            field_7      LIKE s600-umnetwr,
            field_8      LIKE s600-umnetwr,
            field_9      LIKE s600-umnetwr,
            field_10     LIKE s600-umnetwr,
            field_11     LIKE s600-umnetwr,
            field_12     LIKE s600-umnetwr,
            total        LIKE s600-umnetwr,
          END OF gs_months.
    DATA: gs_quotas TYPE ty_quotas,
          gt_quotas LIKE gs_quotas OCCURS 0 WITH HEADER LINE.
    *            S E L E C T I O N - S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-013.
    PARAMETER: p_lis  TYPE tabname,                "plan input
               p_date LIKE /irm/s_ipcisel-etprd,   "end period
               p_emp  TYPE /irm/ip_ktonr,          "sales participant
               p_terr LIKE ztip_sales-zzterritory, "territory
               p_dis  TYPE zzdistrict,             "district
               p_reg  TYPE zzregion.               "region
    SELECTION-SCREEN END OF BLOCK bl1.
    *          S T A R T - O F - S E L E C T I O N
    START-OF-SELECTION.
    *clear all tables, work areas, variables etc
      PERFORM clear_variables.
    *get all the months in the period range
      PERFORM get_periods.
    *retrieve component quotas
      PERFORM component_quota_amt.
    *build field catalogue using internal table
      PERFORM field_catalog_create.
    *build dynamic table
      PERFORM build_dynamic_table.
    *build layout for the ALV list
      PERFORM build_layout.
    *event table to trigger the TOP OF PAGE event to display the heading
      PERFORM eventtab_build USING gt_events[].
    *subroutine for displaying the header which contains the number of
    *datasets selected or displayed
      PERFORM header_build  USING gt_list_top_of_page[].
    *ALV grid display
      PERFORM display_alv_grid.
    *&      Form  clear_variables
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM clear_variables.
      CLEAR:     gs_quotas,
                 gv_count,
                 gv_beg_period,
                 gv_total.
      REFRESH:   gt_quotas.
      MOVE sy-repid TO gv_repid.
    ENDFORM.                    " clear_variables
    *&      Form  get_periods
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_periods.
    *get the fiscal year
      gv_month = p_date+4(2).
      gv_year  = p_date+0(4).
      MOVE gv_month TO gv_count.
      CONCATENATE gv_year c_01 INTO gv_beg_period.
      r_fiscal_period-low    = gv_beg_period.
      r_fiscal_period-high   = p_date.
      r_fiscal_period-sign   = 'I'.
      r_fiscal_period-option = 'BT'.
      APPEND r_fiscal_period.
    ENDFORM.                    " get_periods
    *&      Form  field_catalog_create
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM field_catalog_create.
      DESCRIBE TABLE gt_quotas LINES sy-tabix.
      gv_num_lines = sy-tabix.
      gv_num_lines = gv_num_lines - 1.
      DO gv_num_lines TIMES.
        MOVE sy-index TO gv_line.
        CONCATENATE 'FIELD_' gv_line INTO gs_fldcat-fieldname.
        APPEND gs_fldcat TO gt_fldcat.
      ENDDO.
      MOVE 'TOTAL' TO gs_fldcat-fieldname.
      APPEND gs_fldcat TO gt_fldcat.
    *build field catalog and change the field texts of some of the amount
    *fields more specific
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name         = gv_repid
                i_internal_tabname     = 'GS_MONTHS'
                i_inclname             = gv_repid
                i_bypassing_buffer     = 'X'
           CHANGING
                ct_fieldcat            = gt_fieldcat[]
           EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
      LOOP AT gt_fieldcat INTO gs_fieldcat.
    *condition to check for building a dynamic ALV grid
        CHECK sy-tabix LE gv_count.
        CASE gs_fieldcat-fieldname.
          WHEN 'FIELD_1'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-001 TO gs_fcat-seltext_l.
            MOVE text-001 TO gs_fcat-seltext_m.
            MOVE text-001 TO gs_fcat-seltext_s.
            MOVE text-001 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_2'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-002 TO gs_fcat-seltext_l.
            MOVE text-002 TO gs_fcat-seltext_m.
            MOVE text-002 TO gs_fcat-seltext_s.
            MOVE text-002 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_3'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-003 TO gs_fcat-seltext_l.
            MOVE text-003 TO gs_fcat-seltext_m.
            MOVE text-003 TO gs_fcat-seltext_s.
            MOVE text-003 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_4'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-004 TO gs_fcat-seltext_l.
            MOVE text-004 TO gs_fcat-seltext_m.
            MOVE text-004 TO gs_fcat-seltext_s.
            MOVE text-004 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_5'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-005 TO gs_fcat-seltext_l.
            MOVE text-005 TO gs_fcat-seltext_m.
            MOVE text-005 TO gs_fcat-seltext_s.
            MOVE text-005 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_6'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-006 TO gs_fcat-seltext_l.
            MOVE text-006 TO gs_fcat-seltext_m.
            MOVE text-006 TO gs_fcat-seltext_s.
            MOVE text-006 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_7'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-007 TO gs_fcat-seltext_l.
            MOVE text-007 TO gs_fcat-seltext_m.
            MOVE text-007 TO gs_fcat-seltext_s.
            MOVE text-007 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_8'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-008 TO gs_fcat-seltext_l.
            MOVE text-008 TO gs_fcat-seltext_m.
            MOVE text-008 TO gs_fcat-seltext_s.
            MOVE text-008 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_9'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-009 TO gs_fcat-seltext_l.
            MOVE text-009 TO gs_fcat-seltext_m.
            MOVE text-009 TO gs_fcat-seltext_s.
            MOVE text-009 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_10'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-010 TO gs_fcat-seltext_l.
            MOVE text-010 TO gs_fcat-seltext_m.
            MOVE text-010 TO gs_fcat-seltext_s.
            MOVE text-010 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_11'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-011 TO gs_fcat-seltext_l.
            MOVE text-011 TO gs_fcat-seltext_m.
            MOVE text-011 TO gs_fcat-seltext_s.
            MOVE text-011 TO gs_fcat-reptext_ddic.
          WHEN 'FIELD_12'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-012 TO gs_fcat-seltext_l.
            MOVE text-012 TO gs_fcat-seltext_m.
            MOVE text-012 TO gs_fcat-seltext_s.
            MOVE text-012 TO gs_fcat-reptext_ddic.
        ENDCASE.
        APPEND gs_fcat   TO gt_fcat.
      ENDLOOP.
      LOOP AT gt_fieldcat INTO gs_fieldcat.
        CASE gs_fieldcat-fieldname.
          WHEN 'TOTAL'.
            MOVE-CORRESPONDING gs_fieldcat TO gs_fcat.
            MOVE text-015 TO gs_fcat-seltext_l.
            MOVE text-015 TO gs_fcat-seltext_m.
            MOVE text-015 TO gs_fcat-seltext_s.
            MOVE text-015 TO gs_fcat-reptext_ddic.
            APPEND gs_fcat   TO gt_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " field_catalog_create
    *&      Form  component_quota_amt
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM component_quota_amt.
    *convert the user to a valid format
      PERFORM partid_input_conversion CHANGING p_emp.
      IF p_lis EQ c_600.
    *Employee Monthly Quota Targets
        SELECT   umnetwr
          INTO   TABLE gt_quotas
          FROM   s600                      "Employee Monthly Quota Targets
         WHERE   ssour  EQ space
           AND   vrsio  EQ c_a00
           AND   spmon  IN r_fiscal_period
           AND   pvrtnr EQ p_emp.
      ELSEIF p_lis EQ c_601.
    *Territory monthly quota targets
        SELECT   umnetwr
          INTO   TABLE gt_quotas
          FROM   s601                      "Territory monthly quota targets
         WHERE   ssour      EQ space
           AND   vrsio      EQ c_a00
           AND   spmon      IN r_fiscal_period
           AND   zzterritor EQ p_terr.
      ELSEIF p_lis EQ c_602.
    *District Monthly Quota Targets
        SELECT   umnetwr
          INTO   TABLE gt_quotas
          FROM   s602                      "District  Monthly Quota Targets
         WHERE   ssour      EQ space
           AND   vrsio      EQ c_a00
           AND   spmon      IN r_fiscal_period
           AND   zzdistrict EQ p_dis.
      ELSEIF p_lis EQ c_603.
    *Region Monthly Quota Targets
        SELECT   umnetwr
          INTO   TABLE gt_quotas
          FROM   s603                      "Region Monthly Quota Targets
         WHERE   ssour      EQ space
           AND   vrsio      EQ c_a00
           AND   spmon      IN r_fiscal_period
           AND   zzregion   EQ p_reg.
      ENDIF.
      LOOP AT gt_quotas INTO gs_quotas.
        gv_total = gv_total + gs_quotas-umnetwr.
      ENDLOOP.
      MOVE gv_total    TO gs_quotas-umnetwr.
      APPEND gs_quotas TO gt_quotas.
    ENDFORM.                    " component_quota_amt
    *&      Form  build_dynamic_table
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_dynamic_table.
    *Create dynamic internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
                   EXPORTING
                      it_fieldcatalog = gt_fldcat
                   IMPORTING
                      ep_table        = gt_dyn_table.
      ASSIGN gt_dyn_table->* TO <fs_quota>.
      CREATE DATA gs_dyn_line LIKE LINE OF <fs_quota>.
      ASSIGN gs_dyn_line->* TO <fs_quota_wa>.
      LOOP AT gt_quotas INTO gs_quotas.
        ASSIGN COMPONENT sy-tabix OF STRUCTURE <fs_quota_wa> TO <fs_amount>.
        <fs_amount> = gs_quotas-umnetwr.
      ENDLOOP.
      IF sy-subrc = 0.
        APPEND <fs_quota_wa> TO <fs_quota>.
      ENDIF.
    ENDFORM.                    " build_dynamic_table
    *&      Form  display_alv_grid
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display_alv_grid.
      IF NOT <fs_quota> IS INITIAL.
    * ALV grid display
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
             EXPORTING
                  i_callback_program = gv_repid
                  is_layout          = gt_layout
                  it_fieldcat        = gt_fcat
    *              it_sort            = gt_sortcat
                  i_save             = 'A'
                  it_events          = gt_events
             TABLES
                  t_outtab           = <fs_quota>
             EXCEPTIONS
                  program_error      = 1
                  OTHERS             = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ELSE.
        MESSAGE i013(zip).
      ENDIF.
    ENDFORM.                    " display_alv_grid
    *&      Form  build_layout
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_layout.
      gt_layout-zebra             = 'X'.
      gt_layout-no_vline          = ' '.
      gt_layout-reprep            = 'X'.
      gt_layout-detail_popup      = 'X'.
      gt_layout-window_titlebar   = text-014.
      gt_layout-no_scrolling      = ' '.
      gt_layout-detail_titlebar   = text-014.
      gt_layout-numc_sum          = 'X'.
      gt_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " build_layout
    *&      Form  partid_input_conversion
    *       text
    *      <--P_P_EMP  text
    FORM partid_input_conversion CHANGING p_emp.
      DATA: lv_pernr  TYPE pernr_d.
      lv_pernr  = p_emp.
      p_emp     = lv_pernr.
    ENDFORM.                    " partid_input_conversion
    *&      Form  eventtab_build
    *       text
    *      -->P_GT_EVENTS[]  text
    FORM eventtab_build USING p_lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
    *top of page event is read here to display the heading
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = p_lt_events.
      READ TABLE p_lt_events WITH KEY name =  slis_ev_top_of_page
                             INTO ls_event.
      IF sy-subrc = 0.
        MOVE c_formname_top_of_page TO ls_event-form.
        MODIFY p_lt_events FROM  ls_event TRANSPORTING form
                           WHERE name =  slis_ev_top_of_page.
      ENDIF.
    ENDFORM.                    " eventtab_build
    *&      FORM  TOP-OF-PAGE
    *       text
    FORM top_of_page.
      IF NOT gt_quotas[] IS INITIAL.
    * function module which displayes the number of records selected in the
    *  header part
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
             EXPORTING
                  it_list_commentary = gt_list_top_of_page.
      ENDIF.
    ENDFORM.                    " TOP-OF-PAGE
    *&      Form  header_build
    *       text
    *      -->P_GT_LIST_TOP_OF_PAGE[]  text
    FORM header_build USING p_lt_list_top_of_page TYPE slis_t_listheader.
      DATA: ls_line       TYPE slis_listheader,
            lv_amount(20) TYPE c.
      MOVE gv_total TO lv_amount.
      CONCATENATE text-016 lv_amount INTO gv_text1.
      CONCATENATE gv_text1 'USD' INTO gv_text1 SEPARATED BY space.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = gv_text1.
      APPEND ls_line TO p_lt_list_top_of_page.
    ENDFORM.                    " header_build
    Thanks,

  • Inline XSLT Call Template within Scripting Functoid logic needed

    In my Scripting Functoid, Config Functoid Script, Script type is Inline XSLT Call Template code is as follows.
    <xsl:template name="CanadaInformation">
    <xsl:param name="CanadaClientCd" />
    <xsl:param name="CanadaStatCd" />
    <xsl:element name="CanadaStatus">
       <xsl:choose>
          <xsl:when test="string-length($CanadaStatCd) > 0">
               <xsl:value-of select="$CanadaStatCd"/>
           </xsl:when>
           <xsl:otherwise>
               <xsl:value-of select="$CanadaClientCd"/>
           </xsl:otherwise>
        </xsl:choose>
       </xsl:element>
    </xsl:template>
    In this test case I think the Scripting Functoid is expecting 2 Parameters as input and in most cases the 2 input parameters will have data coming in, but in negative testing I have a case where the 2nd parameter is not passing any data (Value Mapping is
    coming from a Table lookup and the the input is blank, so the table lookup is not executed).
    Instead of trying to test for the length of the string of Parm 2 (which in the negative case there is no value for Parm2), I was wondering if there was a way to count the actual number of Parms being read into the XSLT. In the cases with my positive test,
    the number will be 2 and in the negative case, the number will be one.
    Or is there a way to confirm that there is something in the 2nd Parm.
    Thank you!

    I don't think there is a way count the number of parameter in XSLT (or even in any programing language's procedural calls). Where would execute the code/XSLT to check the count-With in your above "CanadaInformation" template?. What your looking for
    is something at engine level, i.e. is count the number of parameters being read and pass the control based on the number of parameters being read/passed.
    Or close option for this if you have something like overloaded functions/template. In XSLT we don't have anything like overloaded functions/templates.
    If you don't pass/link two parameter, you would error as "The number of inputs to the scripting functoid does not match with the number of inputs expected by the xsl:call-template"
    Your above code shall do the check for value of the parameter. Your code shall handle if "CanadaStatCd" is passed in or not. If you're considering other ways, you have some as follows:
    You can have "<xsl:when test="not($CanadaStatCd)">"- Which is same as parameter not being passed. So your code can be something like:
    <xsl:template name="CanadaInformation">
    <xsl:param name="CanadaClientCd" />
    <xsl:param name="CanadaStatCd" />
    <xsl:element name="CanadaStatus">
    <xsl:choose>
    <xsl:when test="not($CanadaStatCd)"> <!-- parameter has not been supplied -->
    <xsl:value-of select="$CanadaClientCd"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$CanadaStatCd"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:element>
    </xsl:template>
    Have a default values to your parameter and check whether the values are differernt from default values if values are passed in otherwise if the value are still default value, then no value are passed in. Something like:
    <xsl:template name="CanadaInformation">
    <xsl:param name="CanadaClientCd" />
    <xsl:param name="CanadaStatCd" select="'SomeDefaultValue'" /> <!-- SET default -->
    <xsl:element name="CanadaStatus">
    <xsl:choose>
    <xsl:when test="$prefix != 'default-value'">
    <xsl:value-of select="$CanadaStatCd"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$CanadaClientCd"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:element>
    </xsl:template>
    Have another scripting fuctiod before you call the above XSLT-template. Do the check at this scripting function and call the template based on the validation you do at this scripting functiod.
    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.

  • Numbers : Template for My Patient's Dossier

    I'm an eye care practitioner need a template in "Numbers" for my patient's dossier, that after opening of the patient's name I can see all patient's medical history.
    Is there a suitable Number's template for this purpose?

    I'll include a copy of my flow chart in Numbers and the columns of the dosing chart.  I want to be able to enter lbs in C2 for dogs and C3 for cats and have kgs and common drug doses displayed.  Then I'll print the sheet and use it to record anesthesia parameters and times and comments, too.  It then will be part of the permanent medical record. 
    The dose for DexDomitor for dogs is based on body surface area.  I could calculate Meter squared=10.1 X kg to the 2/3 power X 10 to the -4th power and then multiplying that time 0.375 would give MLs dose, too.  If that works, I need a formula for that math in Numbers.
    If I use MATCH or LOOKUP with a chart, where do I put the chart, on page or off page?  Can I link formulas together to recreate the chart?  i.e. 4 lbs is 0.12, 5 lbs is 0.12, etc, so that I can put all the formulas in the C2 cell? 
    Lbs
    Dose in MLs
    4-7
    0.12
    7-9
    0.15
    9-11
    0.20
    11-22
    0.29
    22-29
    0.38
    29-33
    0.44
    33-44
    0.51
    44-55
    0.60
    55-66
    0.69
    66-73
    0.75
    73-81
    0.81
    81-99
    0.90
    99-110
    0.99
    110-121
    1.06
    121-132
    1.13
    132-143
    1.19
    143-154
    1.26
    154-176
    1.35
    >176
    1.42

Maybe you are looking for