Subject:creating macros / automating processeswith stylus Author:chris d Date:17 Aug 2005 12:39 PM
I'm looking at using stylus to convert csv files to xml. when i convert the file each file will need to undergo the same changes to enable it to validate against my dtd - I also need to creat a program tomerge 2 seperate xmlfiles into one (again to enable it validate against a dtd). Is it possible to use macros to automate the xml changes using stylus ?
How would I automate a process of merging two xml files ?
1. You can save the Convert-to-XML map as a .conv file, and use it
as part of a URL like this: adapter:xyz.conv?file:... where the part
after the ? is a fully-qualified URL, so that you can use the same
.conv file for multiple input files.
2. As far as merging, your best bet would be to create a piece of XSLT
or XQuery that does it; there is no generic "merge" program since there
are so many ways two XML files could be merged. But as input, you
could use the above adapter URLs, so that the XSLT or XQuery could
operate on your input files just as if they were XML.
3. You can call a command-line version of XSLT or XQuery. Use the
StylusXSLT.exe or StylusXql.exe programs that are in the Stylus Studio
4. If you build your XSLT or XQuery properly, the output can be made to
conform to a DTD. But you can always call a command-line validator to
do so. We include several, including XSV and Xerces-J, with Stylus
Studio that are packaged as custom validation engines.