Interested in linking to "The ABCs of XML, Part 4"?
You may use the Headline, Deck, Byline and URL of this article on your Web site. To link to this article, select and copy the HTML code below and paste it on your own Web site.
06/08/2007
<xsl:text>”</xsl:text><xsl:value-of select=”Value1”/>
<xsl:text>”,”</xsl:text><xsl:value-of select=”Value2”/>
<xsl:text>” </xsl:text>
Use a CDATA section to simplify using special characters because everything inside of CDATA is ignored by the XML parser. Again, this will not work if your output is to be a mixture of literal text and XSLT elements, as in the previous example. A CDATA section begins with <![CDATA[ and ends with ]]>.
Practical Examples
Example 1: Import DeltaV Modules into MS Access Database
This example fills out the transform that I created for Part 3 of this series. (Control, January 2007). (This XML file is large and may require a bit of time to unzip and view).
Example 2: Convert RSBatch Recipe to a Word Document
This example transforms a Rockwell RSBatch recipe XML file into an MS Word 2003 document. MS Word 2003 supports an XML structure (schema) that includes every feature available from inside Word 2003. A variety of information regarding XML in MS Office 2003 is available.
In case it has not yet sunk in, you can create a Word document with a text editor and some well-formed XML – without installing MS Word! Our transform simply converts the Rockwell RSBatch XML structure into a Word 2003 structure that can be edited inside MS Word 2003.
|
Most of our engineers can use XSLT effectively, but learning WordProcessingML is much more difficult. To bridge the gap, we have created our own simplified intermediate XML language called CascadeDocML.
To support CascadeDocML, we created an XSLT transform that converts from our simplified syntax to full WordProcessingML syntax. Therefore, to generate a Word document is a two-step process: Input XML to CascadeDocML to WordProcessingML.
This is the methodology used for this example. The download for this example includes a document describing the functionality and structure of CascadeDocML, so you may use it for your own applications. (This XML file is large and may require a bit of time to unzip and view).
Example 3: Search and Replace
This example will generate an output file that is an exact copy of the input XML file with keywords replaced according to a list of search/replace pairs defined in a separate file. This transform may be used to duplicate a complete unit configuration where only the tags have changed. This transform is different than performing search/replace in a text editor such as Notepad, as it does not replace everything throughout the file. Our sample input file is a DeltaV XML file in which we want to be very selective about what code elements are available for search/replace.
Although this example may not work perfectly for your specific application, it is extremely modular and easy to extend to your own needs. (This XML file is large and may require a bit of time to unzip and view).
Example 4: Generate Parameter Spreadsheet from RSBatch Area Model
This example will create an Excel spreadsheet of an RSBatch Area Model with each process cell, unit and phase. Each phase will include a detailed list of the phase parameters and reports. One transform in the example creates a CSV text file that may be opened in Excel. The other creates an Excel XML file instead of a CSV file. The Excel XML output includes spreadsheet formatting that is much more complete than a simple CSV file. (This XML file is large and may require a bit of time to unzip and view).
| About the Author |
John T. Sever, president of Cascade Controls, can be reached at johnsever@cascon.com.