Hi,
Currently the XSLT transform element in Switch only supports XSLT 1.0 conversions.
We really need to be able to run 2.0 transformations via Switch. We tried differtent external XSLT parsers but they don't seem to work.
Does anyone have a solution for this?
Kind regards,
Leon Dona
XSLT 2.0 transformations in Switch
XSLT 2.0 transformations in Switch
Hi Leon,
we solved this by creating an external Ruby script (or PHP or whatever you would like to use for it) and call this with a script calling that as an external process. Be sure to make the script take an input file (job.getName()) and an output file (s.createPathWithName) so that you can send the output file onwards in Switch.
Cheers,
Thorsten
we solved this by creating an external Ruby script (or PHP or whatever you would like to use for it) and call this with a script calling that as an external process. Be sure to make the script take an input file (job.getName()) and an output file (s.createPathWithName) so that you can send the output file onwards in Switch.
Cheers,
Thorsten
XSLT 2.0 transformations in Switch
Support for XSLT2.0 is an existing feature request, but can you please describe what you are trying to achieve that requires the use of XSLT2.0? I will add your comments to the feature request to give it some more "meat".
Freddy
Freddy
XSLT 2.0 transformations in Switch
Thanks tz8, i'll look into that.
Freddyp: we have to run an existing complicated XSLT 2.0 script, so there's no possible escape to 1.0...
Leon
Freddyp: we have to run an existing complicated XSLT 2.0 script, so there's no possible escape to 1.0...
Leon
XSLT 2.0 transformations in Switch
This is fairly easy to set up using Saxon9...
1) download Saxon at "SaxonHE9-5-0-1N-setup.exe" at
Saxon 9.5
and install.
2) Open SwitchScripter and create a new script with the folowing properties:
Tag: propTransformCommand
Name: Transform Command
Tooltip: Indicate the Saxon "Transform" command line executable.
Inline editor: Single-line text
Editor 1: Choose file
Tag: propXslTransform
Name: XSLT Document
Tooltip: Choose the XSL transform file
Inline editor: None
Editor 1: Choose file
Copy/paste this code...
Function jobArrived(s, job)
On Error Resume Next
xsltTransformCommandPath = s.getPropertyValue("propTransformCommand")
xsltDocumentPath = s.getPropertyValue("propXslTransform")
tempOutputFilename = job.createPathWithName(job.getName())
transformCommand = """" & xsltTransformCommandPath & """ -s:""" & job.getPath() & """ -xsl:""" & _
xsltDocumentPath & """ -o:""" & tempOutputFilename & """ -ext:on"
job.log 1,transformCommand
set objShell = CreateObject("wscript.shell")
if err.number = 0 then
objShell.Run transformCommand, 1, TRUE
if err.number = 0 then
job.sendToSingle(tempOutputFilename)
else
job.fail "Error running transform [ & err.description & ]"
end if
set objShell = nothing
else
job.fail "Error trying to create WScript Object [ & err.description & ]"
end if
End Function
3) Configure the Script object by indicating the location of the "Tansform.exe" file in the Saxon installation folder as well as the XSL file.
1) download Saxon at "SaxonHE9-5-0-1N-setup.exe" at
Saxon 9.5
and install.
2) Open SwitchScripter and create a new script with the folowing properties:
Tag: propTransformCommand
Name: Transform Command
Tooltip: Indicate the Saxon "Transform" command line executable.
Inline editor: Single-line text
Editor 1: Choose file
Tag: propXslTransform
Name: XSLT Document
Tooltip: Choose the XSL transform file
Inline editor: None
Editor 1: Choose file
Copy/paste this code...
Function jobArrived(s, job)
On Error Resume Next
xsltTransformCommandPath = s.getPropertyValue("propTransformCommand")
xsltDocumentPath = s.getPropertyValue("propXslTransform")
tempOutputFilename = job.createPathWithName(job.getName())
transformCommand = """" & xsltTransformCommandPath & """ -s:""" & job.getPath() & """ -xsl:""" & _
xsltDocumentPath & """ -o:""" & tempOutputFilename & """ -ext:on"
job.log 1,transformCommand
set objShell = CreateObject("wscript.shell")
if err.number = 0 then
objShell.Run transformCommand, 1, TRUE
if err.number = 0 then
job.sendToSingle(tempOutputFilename)
else
job.fail "Error running transform [ & err.description & ]"
end if
set objShell = nothing
else
job.fail "Error trying to create WScript Object [ & err.description & ]"
end if
End Function
3) Configure the Script object by indicating the location of the "Tansform.exe" file in the Saxon installation folder as well as the XSL file.