Subject:XML formatting for data file Author:chih chung Date:22 Mar 2006 05:44 PM Originally Posted: 22 Mar 2006 05:42 PM
I need to format the data file into well-formed XML file with the following requirement:<br>
before XML formatting<br>
type_of_ins="PIERS & DOCKS COVERAGE ON ASSURED'S LOCATION IN DUNEDIN, FL"<br>
after XML formatting: <br>
<type_of_ins>PIERS & DOCKS COVERAGE ON ASSURED' LOCATION IN DUNEDIN, FL</type_of_ins><br>
I just wonder that stylus Studio 2006 XML editor or other tools might have capability to perform the above XML formatting. Please advise. I attach sample data file and expected XML output file for your reference. Thanks.<br>
This need to be done in two steps.
First, create a mapping that converts the sample.txt file into
XML. Second, use XSLT (or XQuery) to change that into the
exact structure you want for output.
First, do File|New|Convert to XML.
Choose your sample.txt file.
Change the following properties:
Delimiter Pairs from blank to '"','"'
Key=Value Character from blank to '='
Row Element Name from "row" to blank
Omit from Output from "Only when Empty" to "Never"
Use File|Save this as something like sample.conv.
Next, you can build your XSLT.
Choose File|New|XSLT: Mapper.
Click on "Add Source Document" and choose sample.txt.
Before clicking Open, put a check in the 'Use Adapter'
box and then choose sample.conv from the subsequent dialog.
Click on "Add Target Document" and choose a sample document
that matches the output you want - in your case,
Now, build your map, which will generate your XSLT.