Closed fab1an closed 5 years ago
Sorry for the late reply.
Does using the output
property not work for you?
If not, you could always use Gradle to rename the output file(s) after the transformation.
I'm generating sourcecode, so I'm using <xml:text>
but want the ending to be *.kt
or *.java
.
I've already solved it by writing a custom incremental task.
I could try the rename task though, you can close this if you want, thanks.
Having seen the following block in SaxonXsltTask.groovy
protected String getDefaultOutputExtension() {
String method = this.xslt.output.@method
return method ? method : 'xml'
}
Do I understand correctly that possible extensions may only be xml|html|xhtml|text|json|adaptive
as per xsl:output
spec? If so, I'd rather add a separate property for defaultOutputExtension
than make a task that copies/renames the transformed files.
Right now I had to make something like
task transformXmls(type: ExtendedSaxonXsltTask) {
outputExtension = 'foo'
...
}
class ExtendedSaxonXsltTask extends com.github.eerohele.SaxonXsltTask {
String outputExtension;
@Override
protected String getDefaultOutputExtension() {
return outputExtension ?: super.getDefaultOutputExtension()
}
}
in my build.gradle
, but it'd be great if this were a part of the plugin.
Do I understand correctly that possible extensions may only be xml|html|xhtml|text|json|adaptive as per xsl:output spec?
Yes.
it'd be great if this were a part of the plugin.
Yes, I can see why you'd want that. I'll look into it.
@virtual-machinist: v0.8.0 adds support for outputFileExtension 'foo'
.
Can you give it a go and report back whether it works OK for you?
Wow, that was fast! :) Works perfectly, thanks!
Glad to hear it, thanks for getting back to me!
Hi, is there a way to customize the extension of the generated file?