support ubl creditnotes

This commit is contained in:
jstaerk
2023-04-14 15:27:07 +02:00
parent 1d5ae5632c
commit c6d786363d
5 changed files with 3254 additions and 0 deletions

View File

@@ -100,6 +100,7 @@ public class ZUGFeRDVisualizer {
String zf1Signature = "rsm:CrossIndustryDocument";
String zf2Signature = "rsm:CrossIndustryInvoice";
String ublSignature = "ubl:Invoice";
String ublCreditNoteSignature = "ubl:CreditNote";
boolean doPostProcessing=false;
if (fileContent.contains(zf1Signature)) {
applyZF1XSLT(fis, baos);
@@ -114,6 +115,11 @@ public class ZUGFeRDVisualizer {
applyUBL2XSLT(fis, iaos);
doPostProcessing=true;
} else if (fileContent.contains(ublCreditNoteSignature)) {
//zf2 or fx
applyUBLCreditNote2XSLT(fis, iaos);
doPostProcessing=true;
}
if (doPostProcessing) {
// take the copy of the stream and re-write it to an InputStream
@@ -174,6 +180,17 @@ public class ZUGFeRDVisualizer {
transformer.transform(new StreamSource(xmlFile), new StreamResult(HTMLOutstream));
}
public void applyUBLCreditNote2XSLT(final InputStream xmlFile, final OutputStream HTMLOutstream)
throws TransformerException {
if (mXsltUBLTemplate==null) {
mXsltUBLTemplate = mFactory.newTemplates(
new StreamSource(CLASS_LOADER.getResourceAsStream(RESOURCE_PATH + "stylesheets/ubl-creditnote-xr.xsl")));
}
Transformer transformer = mXsltUBLTemplate.newTransformer();
transformer.transform(new StreamSource(xmlFile), new StreamResult(HTMLOutstream));
}
public void applyZF1XSLT(final InputStream xmlFile, final OutputStream HTMLOutstream)
throws TransformerException {
Transformer transformer = mXsltZF1HTMLTemplate.newTransformer();