Using XSLT to Create BCP CSV and Format Files
This example demonstrates using XSLT to output text files (as opposed to the usual HTML or XML files). Assume we have been given the following set of XML records and their schema and wish to store them in a database. Most relational databases support some kind of text-based import utility for just this purpose. In this example, we will transform the above XML files into two data files suitable for use with Microsoft SQL Server's command-line BCP (Bulk Copy Program) utility. We will have to convert the input XML into a comma-delimited DAT file, and an input XML schema into a space-delimited FMT file.