Re: [xsl] How to retrieve global parameters names and their default values using Saxon?

Subject: Re: [xsl] How to retrieve global parameters names and their default values using Saxon?
From: Abel Braaksma Online <abel.online@xxxxxxxxx>
Date: Tue, 09 May 2006 00:50:41 +0200
Use:

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



Thanks Andrew, Michael,

Thanks for such quick replies. I wouldn't have expected it to be so rather easy/straightforward after having tried quite some dead-end paths. I see now in the interfaces and docs that there's quite some information about a variable or param, once you get a hold of it. This is great! Now I know that I would not be able to find this myself: it is not in the docs (but it is in the lib). This is a real time and code saver for us, thanks! :)

(strange: a search for getCompiledGlobalVariables returns 3 results on Google, of which none points to saxonica docs ;)

Cheers,
Abel

Current Thread