Re: Re: XML/XHTML fragment to text
I think we were "lost in translation", meaning that terminology between you and us got mixed and we got confused. Let me try to distill from what I understand so far from your two mails:
A. Some legacy system that accepts data in a fixed-width format
B. You want the XSLT to create the full fixed-width format
C. One of the fields "looks like" XML, and, seen as one field, should be correct XML
D. You have to fill out each field until a certain length
E. You seem to have a preference for Xalan-C (but the above is *much* easier with Saxon 8.9!!!)
Your question then was about C above. Consider point E and discuss it please, because you will save for this project and perhaps projects to come hundredths of hours of coding if you can use XSLT 2.0. For instance, making the records fixed length is as easy as 1-2-3 (where you would need recursive templates in XSLT 1.0)
Not sure if you mean if this is already dropped by your team. Anyway, like the suggestion I wrote, it is not that hard to change an XML fragment to text.
Another suggestion if you do want to use XSLT 2.0 eventually: you can code it also as this:
1. First transformation: save HTML to a temporary file
2. Second transformation, all the fields as you normally would
3. When the HTML field passes by, use unparsed-text(...temp file here...) to include the textized HTML data
Now you can have real HTML or XHTML instead of just XML and you don't need to write your own 'serializer' anymore.
Cheers, -- Abel Braaksma
PS: I don't agree that XSLT is hard to use with any ancient legacy system. Our main interface writes data using XSLT 2.0 to many typical legacy systems, including fixed width. Agreed, they don't have XML (but what would a legacy system that does not know XML do with it anyway?) but as I see it, XSLT comes in very handy when creating specialized text-based data formats.
Thanks for your advices, they have been very helpful.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format