XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to next topicNext Topic
Postnext
Bruce CantorSubject: Splitting EDIFACT files pipeline issue
Author: Bruce Cantor
Date: 16 Sep 2020 12:46 PM
Hi

Doing a mapping: EDIFACT --> XML --> EDIFACT.

I need to change a couple of things in the file in order to make the receiver happy, one of them is that he cannot handle more than one message in the same document.

So I need to split my D96A EDIFACT file with multible DESADV messages into mutible files with the same UNBB header.

My problem is related to the split, usually I would split a file with <xsl:result-document> xslt instruction, but the resulting files are placed on the filesystem and not processed further on in the pipeline.

Is it possible to split the file into more files and process each file in the pipeline as separate files?

Help is much appreciated.

/Bruce


DocumentUntitled3.pipeline
Pipeline

Documentsplit.xslt
split attempt

Postnext
Ivan PedruzziSubject: Splitting EDIFACT files pipeline issue
Author: Ivan Pedruzzi
Date: 16 Sep 2020 02:06 PM

You need to switch to XQuery. The code below is a good starting point.

Ivan Pedruzzi
Stylus Studio Team

declare variable $isa := /X12[1]/ISA[1];
declare variable $gs := /X12[1]/GS[1];
declare variable $prefix_uri := replace(document-uri(/), 'converter:EDI\?', '');


for $msg at $pos in /X12[1]/*[starts-with(local-name(.), "TS_")]
let $uri := concat($prefix_uri, '.', $pos)
let $document := <X12>{$isa,$gs,$msg}<GE/><IEA/></X12>
return(
$uri,'&#10;',
ddtek:serialize-to-url($document, $uri, "method=EDI")
)

Posttop
Bruce CantorSubject: Splitting EDIFACT files pipeline issue
Author: Bruce Cantor
Date: 22 Sep 2020 08:49 AM
Thank you Ivan

The code ended up like this, I needed to create a unique dispatch ID for every EDIFACT ORDRSP:

declare variable $unb := /EANCOM/UNB;

declare variable $UNB01 := /EANCOM/UNB/UNB01;
declare variable $UNB02 := /EANCOM/UNB/UNB02;
declare variable $UNB03 := /EANCOM/UNB/UNB03;
declare variable $UNB04 := /EANCOM/UNB/UNB04;

declare variable $UNB05 := substring(/EANCOM/UNB/UNB05,3);

(:converter:EDI:doc=no:field=no:)
declare variable $prefix_uri := replace(document-uri(/), 'converter:EDI:decimal=.:field=no', '');

for $msg at $pos in /EANCOM/DESADV
let $uri := concat($prefix_uri, '.', $pos, '.edi')

let $document := <EANCOM><UNB>{$UNB01,$UNB02,$UNB03,$UNB04}<UNB05>{ $UNB05 }{ $pos }</UNB05><UNB10>V3</UNB10></UNB>{ $msg }<UNZ/></EANCOM>


return ($uri, '&#10;', ddtek:serialize-to-url($document, $uri, "method=EDI:decimal=."))


 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.