Sunday 13 December 2015

Use xslt to Index xml File into Endeca

Here is the small example with steps to use xslt while indexing xml file into Endeca. 

1. First of all configure xml file in Record Adapter of pipeline. 

 

2. Then click on Transformer tab.


Here configure below two fields.

a. Type : The file format of the transformation style sheet.The only valid value is XSLT.
b. URL :  Specifies the location of the .xsl file. The path is either an absolute path or a path relative to the location of the Pipeline.epx file. In this example transform.xsl file is located at the location of the pipeline.epx file.

In this example xslt is used to convert name to uppercase.
------------------------------------------------------------------------------------------------------------------------
 transform.xsl
------------------------------------------------------------------------------------------------------------------------
 <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:template match="/">
<RECORDS>
<xsl:for-each select="employees/employee">
    <RECORD>
         <PROP NAME="P_Age">
             <PVAL><xsl:value-of select="age"/></PVAL>
          </PROP>
          <PROP NAME="P_Name">
             <PVAL><xsl:value-of select="translate(name, $smallcase, $uppercase)"/></PVAL>
          </PROP>
          <PROP NAME="Dep_ID">
             <PVAL><xsl:value-of select="depid"/></PVAL>
          </PROP>
    </RECORD>
</xsl:for-each>
</RECORDS>
</xsl:template>
</xsl:stylesheet>
 ------------------------------------------------------------------------------------------------------------------------

 ------------------------------------------------------------------------------------------------------------------------
Sample input xml file (data.xml)
 ------------------------------------------------------------------------------------------------------------------------
 <?xml version="1.0" encoding="UTF-8"?>
<employees>
   <employee>
      <name>Jon</name>
      <age>20</age>
      <depid>123</depid>
   </employee>
   <employee>
      <name>Ban</name>
      <age>30</age>
      <depid>456</depid>
   </employee>
   <employee>
      <name>Kim</name>
      <age>40</age>
      <depid>789</depid>
   </employee>
</employees>
 ------------------------------------------------------------------------------------------------------------------------
3. Run baseline indexing and see the resutls in jspref.



Tuesday 1 December 2015

Resolved | Missing Discover application folders in Tools And Frameworks

After installing Endeca related softwares I tried to provision the Discover reference application. Then realized that discover application related folders are missing from installation.

Root Cause : ToolsAndFrameworks was installed with installation type Minimal option. This option does not includes the reference application.

Solution : Install ToolsAndFrameworks with installation type Complete option.