Hello:
I know very little XSL, but need to modify some code to add an if condition. Code (given below) generates filename (e.g. "28867_John_1100002275_D009_List of contents_20111221.pdf"). I need to be able to change part of filename from "List of contents" to "Table of contents". I think code like below should do it but not sure where to add it in code:
Code:
<xsl:if $DocumentName="List of contents">
<xsl:value-of select="Table of contents"/>
</xsl:if>
Quick help on this will save me a lot of batch processing. Thanks in advance.
Here is the code I need to modify:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:e="http://www.taleo.com/ws/ob800/2009/04" xmlns:fct="http://www.taleo.com/xsl_functions" exclude-result-prefixes="e fct">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/>
<xsl:param name="OUTBOUND_FOLDER"/>
<xsl:template match="/">
<files>
<xsl:apply-templates select="//e:OnboardingProcessDocument"/>
<!-- here -->
</files>
</xsl:template>
<xsl:template match="e:OnboardingProcessDocument">
<!-- here -->
<xsl:variable name="EmployeeID" select="../../e:Assignment/e:Assignment/e:TalentMasterFile/e:TalentMasterFile/e:User/e:User/e:EmployeeID"/>
<xsl:variable name="DocumentCode" select="e:Document/e:FileBasedDocument/e:Code"/>
<xsl:variable name="DocumentName" select="normalize-space(e:Document/e:FileBasedDocument/e:Name)"/>
<xsl:variable name="DateCreated" select="../../e:RuntimeFields/e:RuntimeField[@name='Now']"/>
<xsl:variable name="LastName" select="../../e:Assignment/e:Assignment/e:TalentMasterFile/e:TalentMasterFile/e:User/e:User/e:LastName"/>
<xsl:variable name="RequisitionNumber" select="../../e:Assignment/e:Assignment/e:Position/e:Position/e:RequisitionNumber"/>
<xsl:variable name="filename" select="fct:normalize-filename(concat($EmployeeID, '_', $LastName, '_', $RequisitionNumber, '_', $DocumentCode, '_', $DocumentName, '_', $DateCreated, '.pdf'))"/>
<file path="{concat($OUTBOUND_FOLDER, '/', $filename)}">
<content>
<xsl:value-of select="e:content"/>
</content>
<Filename>
<xsl:value-of select="$filename"/>
</Filename>
<EmployeeID>
<xsl:value-of select="$EmployeeID"/>
</EmployeeID>
<DocumentCode>
<xsl:value-of select="$DocumentCode"/>
</DocumentCode>
<DocumentName>
<xsl:value-of select="$DocumentName"/>
</DocumentName>
<RequisitionNumber>
<xsl:value-of select="$RequisitionNumber"/>
</RequisitionNumber>
<LastName>
<xsl:value-of select="$LastName"/>
</LastName>
<DateCreated>
<xsl:value-of select="$DateCreated"/>
</DateCreated>
</file>
</xsl:template>
<!-- ======================================= -->
<!-- Normalize filename, replacing invalid characters with '_'. -->
<!-- ======================================= -->
<xsl:function name="fct:normalize-filename">
<xsl:param name="filename"/>
<xsl:value-of select="replace(replace(translate($filename, '\\\/:*?|', '_'), '<', '_'), '>', '_')"/>
</xsl:function>
</xsl:stylesheet>