Subject: Re: [xsl] How to retrieve global parameters names and their default values using Saxon? From: "andrew welch" <andrew.j.welch@xxxxxxxxx> Date: Mon, 8 May 2006 20:11:47 +0100 |
Dear subscribers,
I am a first timer to this list, so I hope to do it a bit right.
We are building a templating system where different data formats can be imported/exported in different other formats, multiple in/multiple out. We use XSLT 2.0 as our format definition language, describing either the input or the export format in it, using a middle format for our storage system where people can edit the contents in a transparent and user friendly interface.
To add to the achieved flexibility, tech-users can add there own import/export definitions using one or more XSLT files. When normal users use some import wizard, we want to present them the global parameters to override some default settings, like "cell-delimiter", "ignore-headers" etc, that were defined in the uploaded XSLT files using (root level) <xsl:param ...>
Question: How can this be achieved? Saxon provides a getParameter and a setParameter. But "getParameter" will not return the default value, and it is not possible to iterate through all available global parameters without knowing their names.
I have looked up the uses of the ParameterSet class, but could not find a way to get this scenario to work. One alternative could be to use XSLT (!) to retrieve all parameters by transforming the original XSLT(s), but how to deal with includes, imports and precedence?
My guess was: if there's a getParameter(), there is somewhere a getParameters() also. But there isn't, at least I couldn't find it. If anyone has an idea or a pointer, I would be very greatful!
compiledStylesheet = stf.newTemplates(new StreamSource(stylesheetPath)); Executable exec = ((PreparedStylesheet)compiledStylesheet).getExecutable(); IntHashMap map = exec.getCompiledGlobalVariables(); Iterator iter = map.valueIterator(); while (iter.hasNext()) { Object var = iter.next(); if (var instanceof GlobalParam) { String name = ((GlobalParam)var).getVariableName(); String value = ((GlobalParam)var).getSelectExpression().toString();
cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to retrieve global parame, Abel Braaksma Online | Thread | RE: [xsl] How to retrieve global pa, Michael Kay |
[xsl] How to retrieve global parame, Abel Braaksma Online | Date | RE: [xsl] How to retrieve global pa, Michael Kay |
Month |