Subject: Re: [xsl] Text To XML using XSL From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 11 Apr 2005 12:24:13 +0100 |
> 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 ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Text To XML using XSL, N. Ganesh Babu | Thread | RE: [xsl] Text To XML using XSL, Michael Kay |
[xsl] Ignoring data before first ma, mylistaddress | Date | Re: [xsl] Ignoring data before firs, David Carlisle |
Month |