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 (1177)
- Stylus Studio Technical Forum (14546)
-> - Splitting EDIFACT files pipeli... (3)
-> ->Splitting EDIFACT files p...
-> ->Splitting EDIFACT files p...
-> + Problem with SAXO processor - ... (5)
-> + PDF Format Help (4)
-> + License check unreliable (2)
-> - XML related issue (1)
-> + Need help regarding pipeline o... (2)
-> + Error converting XML to EDIFAC... (4)
-> + XSLT Profiling for XSLT 1.0 s... (2)
-> + Grouping (2)
-> - Best Toner for Sensitive Skin (1)
-> + Best Practice for Pipeline err... (2)
-> + pdf generation (4)
-> + Problems excuting a Pipeline w... (2)
-> + XML serializer (3)
-> + Supported EDIFACT versions (5)
-> - Anyone know XActimate ESX file... (1)
-> + Stylus Studio with OpenJDK (2)
-> - Encoding error when importing ... (1)
-> - SEO Service in Delhi, India (1)
-> - HP Printer Support (1)
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (247)
+ XSLT Help and Discussion (7615)
+ XQuery Help and Discussion (1946)
+ 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")
)

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


   
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.