Reputation: 67
I want not to show header (column names) in output of xslt code.
I have xslt code which load data into csv file with column names but i dont want to be displayed column header (metadata). how to do that? I am very new to xslt & suggest me some docs to get proficient.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs ws" xmlns:ws="urn:com.workday/workersync"
xmlns:xtt="urn:com.workday/xtt" xmlns:etv="urn:com.workday/etv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0">
<xsl:output method="xml"></xsl:output>
<xsl:template name="Header">
<Line xmlns:xtt="urn:com.workday/xtt" xtt:separator="," xtt:quotes="csv">
<PositionName>PositionName</PositionName>
<EffectiveStartDate>EffectiveStartDate</EffectiveStartDate>
<EffectiveEndDate>EffectiveEndDate</EffectiveEndDate>
<EmployeeID>EmployeeID</EmployeeID>
</Line>
</xsl:template>
<xsl:template match="/">
<File xmlns:xtt="urn:com.workday/xtt" xtt:quotes="csv" xtt:separator="
">
<Record xtt:separator="," xtt:quotes="csv">
<xsl:call-template name="Header" />
</Record>
<xsl:for-each select="ws:Worker_Sync/ws:Worker/ws:Additional_Information">
<xsl:variable name="Current_date">
<xsl:value-of select="current-date()"/>
</xsl:variable>
<Record xtt:separator="," xtt:quotes="csv">
<PositionName>
<xsl:value-of select="ws:PositionName"/>
</PositionName>
<EffectiveStartDate xtt:dateFormat="MM/dd/yyyy">
<xsl:value-of select="$Current_date"/>
</EffectiveStartDate>
<EffectiveEndDate xtt:dateFormat="MM/dd/yyyy">
<xsl:value-of select="ws:EffectiveEndDate"/>
</EffectiveEndDate>
<EmployeeID>
<xsl:value-of select="ws:EmployeeID"/>
</EmployeeID>
</Record>
</xsl:for-each>
</File>
</xsl:template>
</xsl:stylesheet>
Upvotes: 0
Views: 581
Reputation: 163262
You say your XSLT code is producing a CSV file, but that doesn't seem to be the case. Your XSLT code is producing XML, and it looks to me as if that XML is then being passed to some post-processing program that converts that XML to CSV. It's possible (as @user631953 suggests) that removing the call the template named "Header" will have the desired effect, but that's only a guess; without knowing the specification of the post-processing program we really can't know.
Upvotes: 1
Reputation: 11
Possibly removing the whole part:
<Record xtt:separator="," xtt:quotes="csv">
<xsl:call-template name="Header" />
</Record>
will return the result you're looking for? Anyway, would be good to see input and desired output.
Upvotes: 1