How do I use XProc as a copy filter in gradle?

118 Views Asked by At

I have an XQuery script that I want to run against all of the files in a gradle copy task as a filter. I am looking at both XQJ and XProc. Since there is a supported implementation of Calabash in ml-gradle, I decided to go that route.

Is there an example of using XProc as a filter in a gradle copy task?

Here is something that I used for a gradle task for generating xqDoc using the xqDoc java library. I would like some help to do something similar, but using XProc as the filter.

class XQDocFilter extends BaseFilterReader {
  XQDocFilter(Reader input) {
    super(new StringReader(new org.xqdoc.MarkLogicProcessor().process(input.text)))
  }
}

task generateXQDocs(type: Copy) {
  into 'xqDoc'
  from 'src/main/ml-modules'
  include '**/*.xq*'
  rename { it - '.xq*' + '.xml' }
  includeEmptyDirs = false
  eachFile { println it }
  filter XQDocFilter
}
1

There are 1 best solutions below

9
On

I added an XMLCalabashFilter class to xmlcalabash1-gradle starting in version 1.5.0.