[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSLT question

  • From: Mike Brown <mbrown@c...>
  • To: 'rsanford' <rsanford@n...>
  • Date: Wed, 23 Aug 2000 11:33:09 -0600

getting data into xml
> can i use XSLT to convert xml data to/from fixed record data?

Without knowing the details of your fixed record data, it is not possible to
say whether XSLT is really a good tool for the job. Generally XSLT is better
for XML-to-(something XML-like), although "plain" text output in a given
encoding, using characters allowed in XML documents, is pretty easy to do.

Getting data into XML from fixed record data might be much easier to do with
a custom application. XSLT pretty much only lets you access XML files. You
could of course make a dummy file with an entity reference so that the
external file will be one giant text node:

<?xml version="1.0"?>
<!DOCTYPE allTheData [
	<!ELEMENT allTheData (#PCDATA)>
	<!ENTITY theFile SYSTEM "data.txt">

...taking heed that if the encoding of data.txt is not declared with a text
declaration at the top of its file, and is not otherwise evident according
to the rules XML uses, then its encoding will be assumed to be UTF-8. This
will affect how the data is interpreted as characters by the XML parser that
is feeding information about the logical structures to the XSLT processor.

You have a limitation to work around in that the data model used by
XPath/XSLT does not acknowledge characters that are disallowed in XML
documents. The specs do acknowledge that the DOM can be used to manually
construct trees that contain wacky structures, but they don't acknowledge
that you could also use the DOM to create text with characters (or character
sequences) that would be illegal to have in XML documents. You might be able
to get away with it, but I wouldn't rely on it.

If you have an ultimate need to produce bytes that can't easily be derived
from the allowed characters (and it should be noted that most XSLT
processors only support a few output encodings), then you'll need to produce
something "close enough" and then post-process it.



Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.