Re: Text To XML using XSL
> Text > > 1. B H. J. Eichler, P. Gģnter, and D. W. Pohl, <I>Laser-Induced > Dynamic Gratings</I> (Springer, Berlin, 1986). > > 2. B J. D. Ferry, <I>Viscoelastic Properties of Polymers,</I> 3rd ed. > (Wiley, New York, 1980). > > 3. B B. E. Conway, in <I>Modern Aspects of Electrochemistry,</I> > edited by J. O. M. Bockris and B. E. Conway (Butterworths, London, > 1964), p. 43. > > Ah that invalidates most of the replies that you have so far had in this thread. As everyone has noted, Using XSLT2 or perl or anything else with string editing capabilities (personally I like emacs lisp) would be better to convert text to XML. But your input is already XML you presumably want ģ to be interpreted as a character reference and <I>...</I> to be interpreted as an element. If you use the XSLT2 unparsed-text() function then this will _not_ be the interpretation: ģ would just be parsed as 8 characters " & # x 0 1 2 3 ;" It would be possible to use regular expression search to find strings that matched &#x[0-9a-fA-F]+; and then write a hex to decimal conversion function and generate the unicode character of that number, but that sounds like a long way round. If your input is a well formed XML entity then just input it using document() and treat it as an XML to XML transformation. If there is no top level element, either add one explicitly or write a small wrapper xml document taht has a single element and then includes your file as an external entity. The string handling of the text nodes would still be easier with XSLT2's regex functions, but you should start with document() (or doc()) not unparsed-text. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
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