cmarchand / gaulois-pipe

A XSLT pipelining solution
Mozilla Public License 2.0
9 stars 4 forks source link

input-name parameter #9

Closed Marc95 closed 8 years ago

Marc95 commented 8 years ago

I try to use the input name parameter, to not use the base-uri() function in the xslt pipes.

/xsl:param /xsl:param I don't put anything in the gaulois-pipe configuration. But there is no value in the xslt second file of the pipe. Is it the right way to do that?
cmarchand commented 8 years ago

See https://github.com/cmarchand/gaulois-pipe/blob/master/src/test/resources/substitution.xml

It calls parallel.xsl, which declares 2 parameters. One is set via //params/param, the other one by //sources/file. You can set also parameters via command line argument.

A parameter defined in //xsl is given all the time. A parameter defined in //params/param or via command-line is given to all XSL, java-steps, and so on. A parameter defined in //sources/file is given to all XSL / java steps that process this file.

Best regards, Christophe

Marc95 commented 8 years ago

I understood that there always parameter set by the pipe, this are parameter concerning the input file, because of the base-uri() isn't set else in the first xsl file of the pipe. One of this parameter is input-name, isn't it?

cmarchand commented 8 years ago

No, there is no input-name parameter given to XSL.

But there is a pseudo-variable that you can use: <param name="foe" value="$[input-name]"/> This will set xsl param named foe with the name of the input file processed. Other pseudo-variables are input-basename, which is the input file name without extension, and inut-extension, which is the input file name extension.

But input files are loaded via saxon builder (http://www.saxonica.com/documentation/#!javadoc/net.sf.saxon.s9api/DocumentBuilder@build) : builder.build(input.getFile()); So, in the first XSL of the pipe, base-uri() should be available. If not, please file a new issue.