Subject:Help with getting Output XML file Author:Daniel Luczak Date:29 Sep 2008 05:15 PM
I am new to Stylus--
Here is my question using Stylus Studio 2008
I have done the following
For the input file,
choose your CSV file, and tell it to use the XML Converter
select the CSV converter
Switch to the mapping tab
On the right, load your XSD
After I do the mapping how do I save the CSV file into an XML file with only the mapped fields that I mapped from the XSD file.
My Source document is the .csv file and my target document is the XSD file-- How do I get the XML file
Subject:Help with getting Output XML file Author:Minollo I. Date:30 Sep 2008 09:04 AM
The result of defining the mapping is an XSLT (in your case; or an XQuery if you create an XQuery instead); yo get the XML result of your mapping, you need to execute the XSLT (menu XSLT > Preview Result...).
That will generate the result in the Preview window; you can save the XML from there (there is a Save button at the left of the Preview window), or you can also instruct the XSLT to save the result to a specific URI every time the XSLT is executed (XSLT > Scenario Properties... > Output URL
Subject:Help with getting Output XML file Author:Daniel Luczak Date:30 Sep 2008 09:32 AM
I tried your suggestion but I get an xml file with no data
I am attaching the 3 files that I am using
.csv is the original data file which needs to be converted to XML but mapped to fields in the .xsd file
.xsd is the mapping file
.xsl file is the mapping file from stylus Studio.
Maybe I am doing this in the worng steps
I thought I could go from .csv to .xml using the mapping function
Subject:Help with getting Output XML file Author:Minollo I. Date:30 Sep 2008 09:45 AM
I see only one problem: the output URL shouldn't go through a conversion step, but it should just be a URL like "c:\test.xml"
What I get is this:
...no data, but it looks like that data you are mapping is missing from the original CSV you posted, so I guess that's expected.
Subject:Help with getting Output XML file Author:Daniel Luczak Date:30 Sep 2008 10:04 AM
There is not much data that matches in the CSV and XSD but 2 records match the map where there is information in the cpytype (xsd file) and Primary_activity__c (csv file)-- I should get two records in the XML file
Subject:Help with getting Output XML file Author:Minollo I. Date:30 Sep 2008 10:13 AM
I see what you mean; the problem is that your mapping is not iterating through all the records in the source CSV file; you can do that easily, even if I'm not sure which corresponding elements in the XML Schema should be created for each record in the CSV file (I don't see elements marked with multiple occurrence in the XSD).
Anyway, click the right button of the mouse on "row" on the left, drag a line on top of "Cpy" on the right and drop it there; choose "Create repeatable link" and at that point you'll get on "Cpy" element in the output for each "row" in the input, and you'll see some data.
Subject:Help with getting Output XML file Author:Daniel Luczak Date:30 Sep 2008 11:57 AM
It is now working correctly--
One more question
Can I run this conversion from the command line and if yes is there documentation for this or do I need to do this in Java or C #. If it needs to be done in Java or C # do you have a link to sample code
Subject:Help with getting Output XML file Author:Minollo I. Date:30 Sep 2008 01:21 PM
You can do that from the command line using the built-in XSLT processor (StylusXslt.exe); or you can do that from the command line using Saxon (see saxonica dot com). You can also do that in Java or C# (XSLT > Generate Code).
As you are using XML Converters to do CSV to XML, you will need to get the proper XML Converters runtime license to be able to run the conversion through command line or API; the version bundled with Stylus can be used only from within the Stylus Studio UI and as a 14 days evaluation from command line/API. See www.xmlconveters.com/buy for details about how to contact DataDirect sales.