xsl-list
[Top] [All Lists]

Re: [xsl] Shell execution from xslt

2014-09-20 17:35:23


Hi everyone,

Is anyone aware of any xslt library that supports calling shell commands? I 
thinking about writing my own but wanted to know what is out there currently.

I'm not aware of anything.

What I am thinking about is something like:
<xsl:for-each select="shell('ls -1')/line">
...
</xsl:for-each>
where each line would be a line of shell output.

I am also curious if within the constraints of the xslt spec, is it possible 
to take streaming data from the return of an xpath function?


There are certainly no constraints in the spec.

In Saxon you can write a function that returns its results in the form of an 
iterator; Saxon will access items from the iterator on demand. This means for 
example that if you do

d:list-files()[1]

where list-files is implemented this way, it will call the extension function 
to get the first item in the result sequence and then stop.

Given your example, however, in the case of Saxon it would be better to 
implement the extension function in Java rather than in shell-script.

Michael Kay
Saxonica
--~----------------------------------------------------------------
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>
  • [xsl] Shell execution from xslt, Rand McRanderson therandshow(_at_)gmail(_dot_)com
    • Re: [xsl] Shell execution from xslt, Michael Kay mike(_at_)saxonica(_dot_)com <=