Extractor


This document function extracts data from the current Word document and saves it to any data file. This document function is commonly used by DMS systems such as LoboDMS, among others, to correctly index the Word document after the save operation.

The data extractor configuration includes an XSLT script to generate an XML output document. The XML output document contains instructions such as the data file to be saved and the contents of those. The XML output document is structured as follows:

<Extractor> <!-- Instructions how and where to save the data file --> <GlobalSettings> <Settings> <Active> true | false </Active> <!-- Relative path to the location of the Word document --> <Path>.</Path> <!-- File Extension of the data file --> <Extension>xml | csv | oocx | oneoffixx </Extension> <!-- If the data file is to be stored hidden in the file system, this option is true --> <Hidden> true | false </Hidden> </Settings> </GlobalSettings> <FileContent> <!-- Contents of the data file --> </FileContent> </Extractor

The XML output document including all CustomXML data is passed as input to the XSL transformation. A configuration of the Data Extractor could look like this:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oopart="http://schema.oneoffixx.com/OneOffixxContactsPart/1" xmlns:properties="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:extendedproperties="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"> <xsl:output method="xml" version="1.0" encoding="utf-8" /> <!-- Main template --> <xsl:template match="/"> <xsl:element name="Extractor"> <xsl:call-template name="GlobalSettings"/> <xsl:call-template name="FileContent"/> </xsl:element> </xsl:template> <!-- Settings for controlling the data file --> <xsl:template name="GlobalSettings"> <xsl:element name="Settings"> <xsl:element name="Active">true</xsl:element> <xsl:element name="Path">.</xsl:element> <xsl:element name="Extension">xml</xsl:element> <xsl:element name="Hidden">false</xsl:element> </xsl:element> </xsl:template> <!-- FileContent of the data file --> <xsl:template name="FileContent"> <xsl:element name="FileContent"> <xsl:call-template name="MyExtractorFile"/> </xsl:element> </xsl:template> <!-- Output all document parameters --> <xsl:template name="MyExtractorFile"> <xsl:element name="ExtractorData"> <xsl:call-template name="DocumentParameter"/> </xsl:element> </xsl:template> <!-- Document Parameter document function--> <xsl:template name="DocumentParameter"> <xsl:if test="//Parameter"> <xsl:for-each select="//Parameter/*"> <xsl:if test="normalize-space(.)"> <xsl:call-template name="Content"> <xsl:with-param name="node" select="."/> </xsl:call-template> </xsl:if> </xsl:for-each> </xsl:if> </xsl:template> <xsl:template name="Content"> <xsl:param name="node"/> <xsl:variable name="name" select="$node/@id"/> <xsl:element name="{$name}"> <xsl:apply-templates select="node()" /> </xsl:element> </xsl:template> </xsl:stylesheet>

 

PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland