xsl-list
[Top] [All Lists]

Re: [xsl] How to process a sequence of any type as input of a transformation?

2018-06-12 11:04:31
In Saxon you can process a sequence of items using xsl:apply-templates (as the 
"initial match selection") using the API 

Xslt30Transformer.applyTemplates(XdmValue, Destination)

However, this is limited to processing the items in the input sequence 
one-by-one, independently of each other, with no special processing at the 
start or end of the sequence, so it's probably not that useful in practice. And 
it's not available from the command line.

I suspect that in most cases it's actually simpler to do the same as you would 
do in XSLT 2.0, which is to have an initial named template as your entry point, 
and pass the input sequence as a stylesheet parameter which that template then 
processes. One minor convenience is that you can now pass it as a template 
parameter (a tunnel parameter, if you wish) rather than a global parameter.

Michael Kay
Saxonica

On 12 Jun 2018, at 16:39, Olivier Jeulin 
olivier(_dot_)jeulin(_dot_)work(_at_)gmail(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Hello,

according to http://www.exselt.net/features/new-in-xslt-30/ 
<http://www.exselt.net/features/new-in-xslt-30/>
“Any sequence of any type can be the input for the transformation, not just a 
document.”

I haven't found a clear statement of that in the norm, but I'd like to use 
this feature (using Saxon, so if the solution is specific, we can switch to 
the Saxon mailing list).

My use case is to read text lines from the output of another program using a 
pipe (GNU/linux):
someProg | xsltProcessor x.xsl

where the output of someProg is
line1
line2
…
(I know how to do that using a parameter, or a file)

How can I access such a sequence from a stylesheet?


XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <-list/293509> (by email <>)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>