xsl-list
[Top] [All Lists]

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

2006-05-08 15:51:59

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--