• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

eerohele/saxon-gradle: A Gradle plugin for running XSLT transformations with Sax ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

eerohele/saxon-gradle

开源软件地址(OpenSource Url):

https://github.com/eerohele/saxon-gradle

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

Saxon Gradle Plugin

A plugin for running Saxon from Gradle.

Example

repositories {
    mavenCentral()
}

configurations {
    saxon
}

dependencies {
    // Use Saxon-HE 9.9.1-5 instead of the Saxon-HE version that comes with the
    // plugin. 
    saxon 'net.sf.saxon:Saxon-HE:9.9.1-5'
}

plugins {
    id 'com.github.eerohele.saxon-gradle' version '0.9.0-beta4'
}

xslt {
    // Use the Saxon version you specified in the "dependencies" block.
    classpath.from(configurations.saxon)

    stylesheet 'stylesheet.xsl'

    // Transform every .xml file in the "input" directory.
    input fileTree(dir: 'input', include: '*.xml')

    // Set Saxon configuration file.
    config 'config/saxon.xml'

    // Set XSLT parameters.
    parameters(
        debug: true,
        version: project.version
    )
}

See the examples directory in this repository for additional examples.

Benefits

  • A nice and clean syntax for running XSLT transformations with Saxon.
  • Better performance via the Gradle Daemon.
  • Easily configure Saxon either in the Gradle buildfile or via a Saxon configuration file.
  • Only rerun the transformation if the input file(s) or the stylesheet has changed (or if forced with --rerun-tasks).
  • Rapid XSLT development via Gradle's --continuous option: automatically run your stylesheet every time it or your input file changes.
  • Transform Gradle file collections.
  • Use XSLT 3.0 via Saxon-HE 9.8 (or any subsequent Saxon version you need).

Options

The plugin supports all of the same options as the Saxon command-line tool, but with more readable names:

catalog
collectionResolver
config
dtd
expand
explain
initializer
initialMode
initialTemplate
input
lineNumbers
messageReceiver
output
sourceSaxParser
stylesheet
stylesheetSaxParser
suppressJavaCalls
uriResolver
uriSources
useAssociatedStylesheet

The plugin also supports Saxon's advanced options. For a full list of the available advanced options, see the bits between // START ADVANCED OPTIONS and // END ADVANCED OPTIONS in SaxonXsltTask.groovy.

Plugin options

Additionally, the plugin supports these options that aren't related to Saxon:

  • outputFileExtension — specify the file extension you want to use for output files rather than have it be deduced from the XSLT output method
  • outputDirectoryLayout — add outputDirectoryLayout 'nested' to your xslt task if you want your output directory layout to mirror your input directory layout (only if both your input and output directories are under the project base directory)

Limitations

  • Currently only supports XSLT. If you need XQuery support, please open an issue and I'll see what I can do.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap