There's no extension like this built-in to the product, but you should be able to call Runtime.exec() easily enough, for example
 
<xsl:sequence select="Runtime:Runtime:exec('convert -rotate 90 myimage.jpg myrotatedimage.jpg')"
  xmlns:Runtime="java:java.lang.Runtime"/>
 
The tricky bit is getting output from the spawned process. I've only attempted to do this the very crude way of having the spawned process write a file, and then reading this file using unparsed-text().
 
It's much better of course to call an application like ImageMagick through a Java API rather than through a shell command. Have you looked at the JMagick interface (http://www.yeo.id.au/jmagick/)?  (I haven't)
 
Michael Kay
http://www.saxonica.com/
 
 
 
 


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of eNarratives
Sent: 26 October 2006 18:00
To: saxon-help@lists.sourceforge.net
Subject: [saxon] XSLT extension that allows shell out to programs

I am looking for a way to shell out to programs via some sort of XSLT extension and have the returned information available within my transform.  Anything like this available?
 
Specifically, in saxon 8+ I would like to use ImageMagick to return info about an image or modify the image.
 
Something like:
<xsl:variable name="MyImageAttribute" select="shell(identify -myimage.jpg)" /> <!--return info -->
 
<saxon:shell select="convert -rotate 90 myimage.jpg myrotatedimage.jpg" /> <!-- shell out and do something -->
 
Thanks,
Dave