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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
- Stylus Studio Technical Forum (14621)
-> - Stylus Studio - Registrar en o... (1)
-> + Stylus Studio - Registrar en o... (2)
-> + Can a pipeline send a file by ... (2)
-> + After Updateing WIN10 to WIN11... (12)
-> + Where do I add the custom java... (3)
-> + Where is the Diagram tab? (5)
-> + Applying XSLT to Word DOCX/XML (2)
-> - CSV conversion via ConvertToXM... (1)
-> + Text symbols in SS not same as... (4)
-> + Exposing xquery as webservice ... (6)
-> + Syntax Identifier (2)
-> + Saving a Converted XML as an X... (5)
-> + Output document cannot be pars... (4)
-> - Archiving output from conversi... (1)
-> + EDIFACT guideline from Stylus ... (3)
-> + CSV file putting all the data ... (5)
-> + Can't install Home version 64b... (5)
-> + presale - Can I covers this sc... (5)
-> + Problem with UNB (5)
-> - Splitting EDIFACT files pipeli... (4)
-> ->Splitting EDIFACT files p...
-> ->Splitting EDIFACT files p...
-> ->Splitting EDIFACT files p...
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2016)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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")
)

Postnext
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=."))


Posttop
Blue LinkSubject: Splitting EDIFACT files pipeline issue
Author: Blue Link
Date: 27 Nov 2021 10:50 AM
Originally Posted: 27 Nov 2021 10:48 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=n
>o:)
>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>{$UNB
>01,$UNB02,$UNB03,$UNB04}<UN
>B05>{ $UNB05 }{ $pos
>}</UNB05><UNB10>V3
></UNB10></UNB>{
>$msg
>}<UNZ/></EANCOM>
>
>
>return ($uri, '&#10;',
>ddtek:serialize-to-url($docume
>nt, $uri,
>"method=EDI:decimal=."))
>
>

Thank you for sharing superb informations. Your website is very cool. I’m impressed by the details that you have on this website.


https://mcdvoice.me/

   
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.