DITA2Trisoft.xsl file
The sample DITA2Trisoft.xsl file is located in the directory to which you installed SDL DITA2Trisoft. You can use this file as a starting point if you decide to develop a custom XSL file to run during the conversion operation. Running a custom XSL file during the conversion operation can add additional metadata fields to the filemap.xml file.
Overview of the DITA2Trisoft.xsl file
The sample DITA2Trisoft.xsl file performs the following functions:
- Specifies values for the FMASTERTYPE and FMODULETYPE fields
-
It sets the value of the FMASTERTYPE and FMODULETYPE fields to the value of the root element, for example,
bookmap,task, orglossentry. For base DITA topics, the value of the FMODULETYPE field is set togeneric. - Specifies a value for the FCOMMENTS field
-
It adds the following content to the FCOMMENTS field for each DITA topic:
where user-name is the name associated with the SDL LiveContent Architect account that is used to import the content.Topic imported by user-name
Example
The sample file contains the following content:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Sample xsl file for processing the filemap after conversion and before import -->
<xsl:output method="xml"/>
<xsl:param name="user.name" select="'Admin'"/>
<!-- determine the root element of an xml object and add it as a metadatafield -->
<xsl:template match="ishfields[ancestor::file/@filetype!='ISHIllustration']">
<ishfields>
<xsl:variable name="this.file" select="ancestor::file"/>
<xsl:variable name="doc.type" select="name(document(concat('file:///', /filemap/@sourcebasepath, '/', $this.file/@filepath))/*)"/>
<xsl:choose>
<xsl:when test="$this.file/@filetype='ISHMasterDoc'">
<ishfield name="FMASTERTYPE" level="logical">
<xsl:value-of select="$doc.type"/>
</ishfield>
</xsl:when>
<xsl:otherwise>
<ishfield name="FMODULETYPE" level="logical">
<xsl:choose>
<xsl:when test="$doc.type='topic'">
<xsl:value-of select="'generic'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$doc.type"/>
</xsl:otherwise>
</xsl:choose>
</ishfield>
</xsl:otherwise>
</xsl:choose>
<!-- As an example, the metadata field FCOMMENT is added to topics in the filemap -->
<xsl:if test="ancestor::file/@filetype='ISHModule'">
<ishfield name="FCOMMENT" level="lng">
<xsl:value-of select="concat('Topic imported by ', $user.name)"/>
</ishfield>
</xsl:if>
<!-- insert existing metadata fields -->
<xsl:apply-templates/>
</ishfields>
</xsl:template>
<!-- catch all -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>