Re: [xsl] Are there things missing in XSLT which force people to use, say, Java to process XML?

Subject: Re: [xsl] Are there things missing in XSLT which force people to use, say, Java to process XML?
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Sat, 30 Oct 2010 19:14:39 +0200
On 29.10.2010 18:13, Michael Kay wrote:

I was just thinking that the current XSLT standard lacks
interactivity, and was about to suggest an element xsl:prompt for
further revisions of the standard.

Streaming in XSLT creates the intriguing possibility of using the interactive input and output as the primary input and output of the transformation, with XSLT used to transform one into the other.

When processing a source document, the XSLT processor reaches a template where it needs to read input from another source in order to proceed. If the other source is a document (for example, a configuration file), everything is ok. But if the other source is user input, I don't see how this could be achieved by means of streaming.


As you suggest, the streaming scenario is valid if the /primary/ input (the input that fires the events during processing) is being read from stdin. You can type some XML as text, it will be parsed and then transformed according to the streaming mode's templates.

But if another input (a file that is being converted, streaming or not) fires the events, how will you make the processing wait for a certain amount of input from stdin (a character, a line of plain text, some text parsed as an element or a document node, ...), assign this input to a variable and then continue processing with the variable set to the user input?

For example, think of emacs' interactive query-replace vs. replace-string. I'd like to write my own query-replace stylesheets. Or take aspell: The way it works now, XSLT acts like aspell in pipe mode, which is undoubtedly useful. But interactive aspell is useful in many more use cases.

@Dimitre: I'd like to avoid creating extension functions for this because I don't like the deployment overhead that extension functions entail. I think something that may be called xsl:prompt or xsl:input might well be part of core XSLT.

-Gerrit

Current Thread