[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
On 14/08/2012 05:00, Graydon wrote:
David
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________
Re: [xsl] Can unparsed-text() consume an in-memory XML document? Can a string version of an XML document be converted into XML?
Subject: Re: [xsl] Can unparsed-text() consume an in-memory XML document? Can a string version of an XML document be converted into XML? From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 14 Aug 2012 09:56:49 +0100 |
On 14/08/2012 05:00, Graydon wrote:
On Tue, Aug 14, 2012 at 12:12:42AM +0100, David Carlisle scripsit:On 13/08/2012 21:15, Costello, Roger L. wrote:Is there a way in XSLT to convert a string to XML?
That's called parsing. As Michael said XPath 3 drafts include a parse-xml function, or many xslt 1 and 2 processors have such an extension function, or, if you are feeling strange you could write a parser in xslt.
Is there any possibility of getting the XPath 3 functions to _not_ require balanced trees?
I suspect xpath3 is virtually done but you can put in a feature request via bugzilla for xpath n (I'm not on the working group, so can't say how well received that would be:-)
In practice you can do something along those lines already as (as for top level document parsing) many products allow the xml parser to be specified external to the xslt, and as long as the parser returns xml-like sax parse events xpath doesn't really care what the input syntax looks like, so you can supply an html parser (tag soup for example for java xslt processors) which will consume (and "fix up") markup that is not well formed.
The only time I've had to use this kind of functionality, it was to take a horrible mess of semi-colon-space separated link-like things embedded in a mass of text where the text could be decorated with various bits of markup -- bold, italic, "term", actual link markup of various flavours -- and serialize it so it could be split at the semi-colon spaces.
The results of tokenization had to go back into XML and be processed, and the tokens certainly weren't balanced trees.
It's not that hard to write a function to do this, but it would be nice to not have to.
David
-- google plus: https:/profiles.google.com/d.p.carlisle
________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Can unparsed-text() consu, Graydon | Thread | Re: [xsl] Can unparsed-text() consu, Martin Honnen |
Re: [xsl] Can unparsed-text() consu, Graydon | Date | Re: [xsl] Can unparsed-text() consu, Martin Honnen |
Month |