Project

Profile

Help

Bug #4212 » XMLtoCSV_CONF.xslt

Library - Juan Lopez, 2019-05-10 12:35

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes" xmlns:csv="csv:csv" xmlns:my="my:my" exclude-result-prefixes="my csv xsl xs fn xdt">
<!-- Text file configuration -->
<!--
Variable CONF store fields that will be shown in target CSV file

Each attribute key contains XML node that will be shown in CSV file. Order of @key nodes determine order in CSV file. It is possible to create new fields in target file with blank, zeros or default values

Attribute @header allows to use a different name of XML node naming convention. Useful in case of headers option. It is optional.
Attribute @len determines how many chars will be written in file removing unnecesary leading, trailing or duplicates spaces first. It is mandatory for numeric fields.
Attribute @typ determines field data type ("S" String, "N" numeric, "D" dates). Combined with other attributes allow enhance features like conversions. It is optional.
Attribute @case determines if content field will be formatted in upper case "U" or lower case "L" letters. Use when data type is string or unknown. It is optional.
Attribute @default provides an initial value when xml node doesn't exist or is empty. For numeric fields value is 0 if this attribute is not customized.

-->
<xsl:variable name="CONF">
<cols>
<col key="FILL1" header="Cl."/>
<col key="FILL2" header="Run Id"/>
<col key="FILL3" header="Record Typ" default="305"/>
<col key="FILL4" header="Seq. Number"/>
<col key="PERSON_NO" header="Empl. Id"/>
<col key="FILL6" header="Error detected"/>
<col key="FILL7" header="Error Log"/>
<col key="STATUS" header="Active"/>
<col key="FNAME" header="Firstname"/>
<col key="LNAME" header="Lastname"/>
<col key="FILL11" header="Login"/>
<col key="EMAIL" header="Email"/>
<col key="FILL13" header="Region"/>
<col key="COUNTRY" header="Country"/>
<col key="FILL15" header="Locale"/>
<col key="FILL16" header="Curr."/>
<col key="FILL17" header="Company"/>
<col key="CC" header="Cost Ctr"/>
<col key="FILL19" header="Fi Company"/>
<col key="FILL20" header="Ledger"/>
<col key="FILL21" header="System"/>
<col key="GBU" header="GBU"/>
<col key="FILL23" header="SubGBU"/>
<col key="FILL24" header="Site"/>
<col key="MANAGER" header="Manager"/>
<col key="FILL26" header="Ctr"/>
<col key="FILL27" header="REQ_ROLE"/>
<col key="FILL28" header="TRAV_ROLE"/>
<col key="FILL29" header="APPR_ROLE"/>
<col key="FILL30" header="IS_MANAGER"/>
<col key="FILL31" header="IS_EXPAT"/>
<col key="FILL32" header="OUT_OF_SCOPE"/>
<col key="FILL33" header="Pos Ee. Id"/>
<col key="FILL34" header="Comp of S."/>
<col key="FILL35" header="Ctry of S."/>
<col key="FILL36" header="Vendor ID"/>
<col key="FILL37" header="New Pernr"/>
<col key="FILL38" header="Old Pernr"/>
<col key="FILL39" header="Travel Cl"/>
<col key="FILL40" header="Travel Org"/>
<col key="FILL41" header="EEGrp"/>
</cols>
</xsl:variable>
<!-- Text file configuration -->
</xsl:stylesheet>
<!-- EXAMPLE of configuration
<xsl:variable name="CONF">
<cols>
<col key="DUMMY" len="1" typ="S" default="7" header="N"/>
<col key="DC" len="2" default="888"/>
<col key="NN" len="2" typ="N" default="77"/>
<col key="NAME" typ="S" case="L" header="Na me"/>
<col key="DOB" typ="D" header="DOB"/>
<col key="DUMMY" typ="S" case="U"/>
<col key="AGE" len="5" typ="N"/>
<col key="JOB" header="Job"/>
</cols>
</xsl:variable>
-->
(4-4/5)