This repository has been archived by the owner on Jul 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathStylesheet_Full.xsl
571 lines (437 loc) · 17.5 KB
/
Stylesheet_Full.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
<?xml version="1.0" encoding="UTF-8"?>
<!--
******************************************************************************************************************
PEPPOLInstance Documentation - reference stylesheet
title= Stylesheet_Full.xsl
publisher= "Difi"
created= 2014-12-02
conformsTo= UBL-Invoice-2.1.xsd
description= "Stylesheet for EHF Invoice and Creditnote, PEPPOL BIS 4A and 5A, version 2.0
This stylesheet was drawn up to serve developers and end-users as a neutral reference tool when
assessing transaction content. The purpose of the reference stylesheet is
- To visualise all data structures, including all their occurrences, in transaction instances
compliant to EHF Invoice and creditnote, in addition to BIS 4A and 5A;
- To show all data as is, i.e. without any editing;
- To show relevant attributes: that is, attributes are displayed only to the extent that they have
any impact on the understanding or interpretation of an element value. For example, a fix listID
(like UNCL1001) would not be displayed.
The assumption is that is that the stylesheet is applied to messages that are formally correct, i.e.
messages that comply with XML schema and schematron rules. However, as this reference stylesheet is
likely to be used also in test environments, some basic validation features have been included,
and any consequential errors are displayed as needed."
Derived from work by SFTI, Sweden and OIOUBL, Denmark.
******************************************************************************************************************
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n1="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:n2="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ccts="urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2"
xmlns:sdt="urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2"
xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
exclude-result-prefixes="n1 n2 cac cbc ccts sdt udt">
<xsl:include href="CommonTemplates.xsl"/>
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
<xsl:strip-space elements="*"/>
<!--Add path to PEPPOL.css file in select attribute, if located in another folder-->
<xsl:param name="pStylesheetDir" select="''"></xsl:param>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="n1:Invoice | n2:CreditNote">
<!-- Start HTML -->
<html lang="{$pLang}">
<head>
<link rel="Stylesheet" type="text/css" href="{$pStylesheetDir}PEPPOL.css"/>
<title>EHF Faktura og kreditnota</title>
</head>
<body>
<!-- Start on header-->
<table>
<tr>
<td colspan="4">
<h3>
<b>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='IssueDate']/g-lang[lang($pLang)]"/></b> 
<!-- Inserting Invoice Date -->
<xsl:value-of select="cbc:IssueDate"/>
</h3>
<br/>
</td>
<td colspan="4">
<h3>
<xsl:choose>
<xsl:when test="/n1:Invoice">
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='InvoiceID']/g-lang[lang($pLang)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='CreditNoteID']/g-lang[lang($pLang)]"/>
</xsl:otherwise>
</xsl:choose>
 
<!-- Inserting Invoice ID -->
<xsl:value-of select="cbc:ID"/>
</h3>
<br/>
</td>
</tr>
<tr>
<td colspan="2">
<xsl:if test="cbc:AccountingCost !=''">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AccountingCost']/g-lang[lang($pLang)]"/> </h2>
<xsl:value-of select="cbc:AccountingCost"/>
</xsl:if>
</td>
<td colspan="2">
<xsl:if test="cac:InvoicePeriod !=''">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='InvoicePeriod']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:InvoicePeriod"/>
</xsl:if>
</td>
<td colspan="2">
<xsl:if test="cac:OrderReference/cbc:ID !=''">
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='OrderReferenceID']/g-lang[lang($pLang)]"/> </h2>
<!-- Inserting Order reference number -->
<xsl:value-of select="cac:OrderReference/cbc:ID"/>
</xsl:if>
</td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<!-- Start of Parties (in header) -->
<tr>
<td colspan="2">
<!-- Inserting Accounting Supplier Party-->
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AccountingSupplierInv']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:AccountingSupplierParty"/>
</td>
<td colspan="2">
<!-- Inserting contact information -->
<xsl:if test="cac:AccountingSupplierParty/cac:Party/cac:Contact !=''">
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AccSupContact']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:AccountingSupplierParty/cac:Party" mode="accsupcontact"/>
</xsl:if>
</td>
<td colspan="2">
<!-- Inserting Accounting Customer Party -->
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AccountingCustomerInv']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:AccountingCustomerParty"/>
</td>
<td colspan="2">
<xsl:if test="cac:AccountingCustomerParty/cac:Party/cac:Contact !=''">
<!-- Inserting Contact information-->
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AccCusContact']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:AccountingCustomerParty/cac:Party" mode="acccuscontact"/>
</xsl:if>
</td>
</tr>
<xsl:if test="cac:PayeeParty !='' or cac:TaxRepresentativeParty !='' or cac:Delivery !='' ">
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<tr>
<td colspan="2">
<xsl:if test="cac:PayeeParty !=''">
<!-- Inserting Payee Party -->
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PayeeParty']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:PayeeParty"/>
</xsl:if>
</td>
<td colspan="2">
<xsl:if test="cac:TaxRepresentativeParty !=''">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TaxRepresentativeParty']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:TaxRepresentativeParty"/>
</xsl:if>
</td>
<xsl:apply-templates select="cac:Delivery" mode="DocumentHeader"/>
</tr>
</xsl:if>
<!-- Any additional information on document level or referenced/attached documents: -->
<xsl:if test="cbc:Note[.!=''] or cac:ContractDocumentReference !='' or cac:AdditionalDocumentReference !=''or cac:BillingReference !=''">
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<tr>
<td colspan="4">
<xsl:if test="cbc:Note[.!='']">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='HeaderNotes']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cbc:Note"/>
</xsl:if>
</td>
<td colspan="4">
<xsl:if test="cac:ContractDocumentReference !=''">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='ContractDocumentReference']/g-lang[lang($pLang)]"/>
</h2>
<xsl:apply-templates select="cac:ContractDocumentReference"/>
</xsl:if>
<xsl:if test="cac:AdditionalDocumentReference !=''">
<xsl:if test="cac:ContractDocumentReference !=''">
</xsl:if>
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AdditionalDocumentReferenceID']/g-lang[lang($pLang)]"/>
</h2><xsl:apply-templates select="cac:AdditionalDocumentReference"/>
</xsl:if>
<xsl:if test="cac:BillingReference !=''">
<xsl:if test="cac:ContractDocumentReference !='' or cac:AdditionalDocumentReference !=''">
</xsl:if>
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='BillingReference']/g-lang[lang($pLang)]"/>
</h2><xsl:apply-templates select="cac:BillingReference"/>
</xsl:if>
</td>
</tr>
</xsl:if>
<!-- Allowances and charges on document level: -->
<xsl:if test="cac:AllowanceCharge !='' ">
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<tr>
<td colspan="8">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='DocLevelAllowanceChargeInf']/g-lang[lang($pLang)]"/></h2>
</td>
</tr>
<tr>
<td colspan="2">
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AllowanceOrChargeIndicator']/g-lang[lang($pLang)]"/></b>
</td>
<td colspan="2">
<xsl:if test="cac:AllowanceCharge/cbc:AllowanceChargeReasonCodeType !=''">
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AllowanceOrChargeReasonCode']/g-lang[lang($pLang)]"/></b>
</xsl:if>
</td>
<td colspan="2">
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AllowanceOrChargeReason']/g-lang[lang($pLang)]"/></b>
</td>
<td>
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AllowanceOrChargeTax']/g-lang[lang($pLang)]"/></b>
</td>
<td class="right">
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AllowanceOrChargeAmount']/g-lang[lang($pLang)]"/></b>
</td>
</tr>
<xsl:apply-templates select="cac:AllowanceCharge" mode="DocumentLevel-new"/>
</xsl:if>
<!-- End of invoice header -->
<!-- Start tax totals: -->
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<tr>
<td colspan="2">
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TaxInfo']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td colspan="2">
<xsl:if test="cbc:TaxPointDate !=''">
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TaxPointDate']/g-lang[lang($pLang)]"/></b>
 <xsl:value-of select="cbc:TaxPointDate"/>
</xsl:if>
</td>
<td colspan="4">
<xsl:if test="cbc:TaxCurrencyCode !=''">
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TaxCurrencyCode']/g-lang[lang($pLang)]"/></b>
 <xsl:value-of select="cbc:TaxCurrencyCode"/>
<xsl:if test="cbc:TaxCurrencyCode/@listID !='ISO4217'">
<small> [<xsl:value-of select="cbc:TaxCurrencyCode/@listID"/> - invalid listID]</small>
</xsl:if>
</xsl:if>
<xsl:if test="cac:TaxExchangeRate !='' ">
<small>
<br/>
 <xsl:apply-templates select="cac:TaxExchangeRate"/>
</small>
</xsl:if>
</td>
</tr>
<xsl:if test="cac:TaxTotal">
<tr class="TAXInformationHeader">
<td colspan="2">
<b>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TAXCategoryIDInf']/g-lang[lang($pLang)]"/>
</b>
</td>
<td colspan="2">
<xsl:if test="cac:TaxSubTotal/cac:TaxCategory/cbc:TaxExemptionReason !='' ">
<b>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TaxExemptionReason']/g-lang[lang($pLang)]"/>
</b>
</xsl:if>
</td>
<td colspan="2">
<b>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TaxableAmountInf']/g-lang[lang($pLang)]"/>
</b>
</td>
<td class="right">
<xsl:if test="cac:TaxSubTotal/cbc:TransactionCurrencyAmount !='' ">
<b>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TransactionCurrencyTaxAmount']/g-lang[lang($pLang)]"/>
</b>
</xsl:if>
</td>
<td class="right">
<b>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='TAXAmountInf']/g-lang[lang($pLang)]"/>
</b>
</td>
</tr>
<xsl:apply-templates select="cac:TaxTotal/cac:TaxSubtotal"/>
</xsl:if>
<!--End document taxes -->
<!-- Start document totals: -->
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<!-- Fix document totals -->
<tr>
<td colspan="7">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='DocTotals']/g-lang[lang($pLang)]"/></h2>
</td>
<td class="right small">
<xsl:if test="cac:LegalMonetaryTotal/cbc:PayableRoundingAmount !='' ">
<b><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PayableRoundingAmount']/g-lang[lang($pLang)]"/></b>
<br/>
<xsl:apply-templates select="cac:LegalMonetaryTotal/cbc:PayableRoundingAmount"/> <xsl:apply-templates select="cac:LegalMonetaryTotal/cbc:PayableRoundingAmount/@currencyID"/>
</xsl:if>
</td>
</tr>
<xsl:apply-templates select="cac:LegalMonetaryTotal" mode="New"/>
<!-- Start on PAYMENT TERMS information -->
<xsl:if test="cac:PaymentTerms !=''">
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<tr>
<td colspan="2">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PaymentTerms']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td colspan="6">
<table>
<xsl:apply-templates select="cac:PaymentTerms"/>
</table>
</td>
</tr>
</xsl:if>
<!-- End of PAYMENT TERMS information -->
<!-- Start on PAYMENT MEANS information -->
<xsl:if test="cac:PaymentMeans !=''">
<tr>
<td colspan="8">
<hr/>
</td>
</tr>
<tr>
<td colspan="8">
<h2><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PaymentMeans']/g-lang[lang($pLang)]"/>
</h2>
</td>
</tr>
<tr>
<th><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PaymentMeansCode']/g-lang[lang($pLang)]"/></th>
<th>
<xsl:if test="cac:PaymentMeans/cbc:PaymentChannelCode !=''">
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PaymentChannelCode']/g-lang[lang($pLang)]"/>
</xsl:if>
</th>
<th colspan="2"><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PayeeFinancialAccountID']/g-lang[lang($pLang)]"/></th>
<th colspan="2"><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='FinancialInstitutionID']/g-lang[lang($pLang)]"/></th>
<th><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PaymentRef']/g-lang[lang($pLang)]"/></th>
<th class="right"><xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PaymentDueDate']/g-lang[lang($pLang)]"/></th>
</tr>
<xsl:apply-templates select="cac:PaymentMeans"/>
<!-- End of PAYMENT MEANS information -->
</xsl:if>
</table>
<!--Start Invoice & Credit Note line-->
<table>
<tr>
<td colspan="9">
<hr/>
</td>
</tr>
<tr class="UBLInvoiceLineHeader">
<td>
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='LineID']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td>
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='SellersItemIdentification']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td>
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='ItemName']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td class="right">
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='Quantity']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td class="center">
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='QuantityUnitCode']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td>
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='PriceUnit']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td>
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='LineTaxDetails']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td>
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='AllowanceCharge(Line)']/g-lang[lang($pLang)]"/>
</h2>
</td>
<td class="right">
<h2>
<xsl:value-of select="$moduleDoc/module/document-merge/g-funcs/g[@name='LineExtensionAmountLine']/g-lang[lang($pLang)]"/>
</h2>
</td>
</tr>
<xsl:apply-templates select="cac:InvoiceLine | cac:CreditNoteLine"/>
</table>
<!--End Invoice & Credit Note line -->
</body>
</html>
</xsl:template>
</xsl:stylesheet>