How do I create a variable field in xsl 1.0 called batch number with the
following format requirement. Attempted to code myself - getting error
We only have Xsl 1.0 not 2.0 as previously stated.
YYYYMMDDHHmmXCUR where
YYYYMMDD is current date - converted to a string field
HH is current hour - converted to a 2 character string field
mm is current minutes -converted to a 2 character string field
X will either be L for Leddy or W for Law depending on the value
from <po_line_owner> field (see below)
invoice_list/invoice/invoice_line_list/invoice_line/po_line_info/
po_line_owner
CUR will be a Currency value of (CDN or USD) and pulled from the
invoice_list/invoice/invoice_amount/currency
What values would I find in the po_line_owner:
<po_line_owner>Paul Martin Law Library</po_line_owner>
<po_line_owner>Leddy Library</po_line_owner>
Note: if we find the word Law in po_line_owner then make value of
X a "W" otherwise make the X value an "L"
Below in my xsl code am getting a syntax error on the following line
<xsl:variable name="CurrDateTimeValue"
select="format-dateTime(current-dateTime(),"[Y0001][M01][D01][H01][m01]")"/>
Element type "xsl:variable" must be followed by either attribute
specifications, ">" or "/>".
Here is my xsl code
<?xml version="1.0" encoding="UTF-8" ?>
<!-- New document created with EditiX at Thu Oct 23 16:28:34 EDT 2014 -->
<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/xpath-functions"
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
xmlns:err="http://www.w3.org/2005/xqt-errors"
exclude-result-prefixes="xs xdt err fn">
<xsl:output method="text" indent="no"/>
<xsl:variable name="GLDateValue"
select="format-date(current-date(),"[Y0001][M01][D01]")"/>
<xsl:variable name="CurrDateTimeValue"
select="format-dateTime(current-dateTime(),"[Y0001][M01][D01][H01][m01]")"/>
<!-- OUSTANDING OUTPUT DATA ISSUES -->
<!-- xsl:value-of select="../../../../../vendor_FinancialSys_Code"
/>, need to check for zero or nil then use 99999 otherwise take the value
-->
<!-- xsl:value-of select="../../../../../hardcode_RemarkString"
/>, derived field -->
<!-- xsl:value-of select="../../../../../hardcode_GLDate" />,
current date in format yyyymmdd -->
<!-- xsl:value-of select="../../../../../hardcode_BatchNo" />,
format yyyymmddhhmmXCUR where X is value from Line Owner (L-Leddy, W-Law),
CUR is from invoice_amount/currency, yyyymmddhhmm is current date -->
<!-- xsl:value-of select="../../../../../hardcode_PayTerms" />,
derived from part of invoice/invoice_number -->
<!-- xsl:value-of select="../../../../../hardcode_Attachments" />,
derived from part of invoice/invoice_number -->
<xsl:template match="/">
<xsl:for-each
select="payment_data/invoice_list/invoice/invoice_line_list/invoice_line/fund_info_list/fund_info/amount">
<xsl:variable name="InvoiceDateValue"
select="translate(../../../../../invoice_date,'/','')"/>
<xsl:variable name="InvoiceDateYYYYMMDD"
select="concat(substring($InvoiceDateValue,5,4),substring($InvoiceDateValue,1,2),substring($InvoiceDateValue,3,2))"/>
<xsl:variable name="InvoiceCurrency"
select="../../../../../invoice_amount/currency"/>
<xsl:variable name="InvoicePOLineOwner"
select="../../../../invoice_line/po_line_info/po_line_owner"/>
<xsl:choose>
<xsl:when
test="contains-case-insensitive($InvoicePOLineOwner, 'Law')">
<xsl:variable name="POOwnerType"
select="W'" />
</xsl:when>
<xsl:otherwise>
<xsl:variable
name="POOwnerType" select="L" />
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="LibrBatchNo"
select="concat($CurrDateTimeValue,$InvoicePOLineOwner,$
InvoiceCurrency)"/>
<xsl:value-of
select="../../../../../invoice_number" />,
<xsl:value-of
select="../../../../../invoice_amount/sum" />,
<xsl:value-of
select="../../../../../invoice_amount/currency" />,
<xsl:value-of select="../../../../../vendor_code"
/>,
<xsl:value-of
select="../../../../../unique_identifier" />,
<xsl:value-of select="$InvoiceDateYYYYMMDD"/>,
<xsl:value-of select="$GLDateValue"/>,
<xsl:value-of
select="../../../../../payment_method" />,
<xsl:value-of
select="../../../../../invoice_exchange_rate_list/exchange_rate/rate" />,
<xsl:value-of select="sum" />,
<xsl:value-of select="../fiscal_period" />,
<xsl:value-of select="../external_id" />,
<xsl:value-of select=".$LibrBatchNo" />
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Small Portion of XML file below
<?xml version="1.0"?>
<payment_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://com/exlibris/repository/acq/invoice/xmlbeans">
<invoice_list>
<invoice>
<invoice_number>PO-305</invoice_number>
<approved_by>Belanger Patricia</approved_by>
<invoice_amount>
<currency>USD</currency>
<sum>22</sum>
</invoice_amount>
<vendor_code>ABE</vendor_code>
<vendor_name>ABEBOOKS</vendor_name>
<vendor_FinancialSys_Code xsi:nil="true"/>
<vendor_liable_for_vat>false</vendor_liable_for_vat>
Snipet
removed........................................................
<unique_identifier>2014082450002181</unique_identifier>
<invoice_date>07/24/2014</invoice_date>
<payment_method>ACCOUNTINGDEPARTMENT</payment_method>
Snipet removed............................
<invoice_line_list>
<invoice_line>
<line_number>1</line_number>
<line_type>REGULAR</line_type>
<quantity>1</quantity>
<reporting_code>PRINTBOOK</reporting_code>
<total_price>20.0</total_price>
<price>20.0</price>
<po_line_info>
<fully_Invoiced_ind>true</fully_Invoiced_ind>
<po_line_owner>Leddy
Library*</po_line_owner>
<mms_record_id>99178220802181</mms_record_id>
<meta_data_values>
<acqterms_identifier>0199669937</acqterms_identifier>
<acqterms_identifierType>ISBN</acqterms_identifierType>
<acqterms_place>Oxford :</acqterms_place>
<creator>Mayer, C.
P. (Colin P.)</creator>
<date>2013.</date>
<publisher>Oxford
University Press</publisher>
</meta_data_values>
<vendor_note xsi:nil="true
"/>
<vendor_reference_number>order number 102</vendor_reference_number>
<additional_order_reference xsi:nil="true"/>
<po_line_number>POL-411</po_line_number>
<po_line_price>20.0</po_line_price>
<po_line_title>Firm
commitment : why the corporation is failing us and how to restore trust in
it / Colin Mayer.</po_line_title>
</po_line_info>
_____________________________________________________________________
Catherine Wilbur | Senior Application Programmer | IT Services
401 Sunset Avenue, Windsor ON Canada N9B 3P4
(T) 519.253.3000 Ext. 2745 | (F) 519.973.7083 | (E)
cwilbur(_at_)uwindsor(_dot_)ca
www.uwindsor.ca/its
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--