Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 9th, 2018, 10:45 AM
Registered User
 
Join Date: Apr 2018
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Simple question on the possibility of xslt

Hello everybody,

Before begin my developments, I would like to know if it is possible to do it :

My input file is a .txt which looks like to a csv.
My output file is a "real" .csv.

My txt is really particular like it :
Code:
01;FILE_HEAD;CUSTOMERS;INFO1;INFO2;INFO3
02;CUST_HEAD;CUST1;CUST_NAME
03;CUST_NUM;CUST1;PHO;0001;+33 XX
04;CUST_NUM;CUST1;PHO;0002;+33 YY
05;CUST_NUM;CUST1;FAX;0001;+33 ZZ
06;CUST_ADV;CUST1;NEWInfo
07;CUST_HEAD;CUST2;CUST_NAME2
09;CUST_ADV;CUST2;NEWInfo2
10;CUST_HEAD;CUST3;CUST_NAME3
11;FILE_HEAD;CUSTOMERS;INFO1;INFO2;INFO3
I would like to transform it in :
Code:
INFO1,INFO2,INFO3,INFO4,CUST_NAME,+33 XX,+33 ZZ,NEWInfo
INFO1,INFO2,INFO3,INFO4,CUST_NAME,+33 YY,+33 ZZ,NEWInfo
INFO1,INFO2,INFO3,INFO4,CUST_NAME2,,,NEWInfo2
INFO1,INFO2,INFO3,INFO4,CUST_NAME3,,,
Do you think it is possible ?
Sorry, but I a real newbie in XSLT...
 
Old April 9th, 2018, 10:50 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's certainly possible in XSLT, though as there's no XML involved other rule-based languages like awk might be better.

If you're going to use XSLT, make sure it's version 2.0 or higher: you'll need features like regular expressions and unparsed-text() that don't appear until 2.0.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old April 9th, 2018, 11:26 AM
Registered User
 
Join Date: Apr 2018
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okey thank you for the information, i am going to try it now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT: a simple question ratnalein XSLT 3 February 4th, 2013 12:26 PM
Simple XSLT Problem (HELP PLEASE) gaeawalker XSLT 2 October 10th, 2007 10:27 AM
simple XSLT apply-templates question fannus XSLT 7 March 27th, 2007 02:11 AM
simple XSLT question _thinking XSLT 4 January 24th, 2006 10:41 AM
Simple question about XSLT bertcox XSLT 2 May 5th, 2004 09:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.