Search code examples
xsltsaxon

Displaying all stylesheet parameters In XSLT


Does Saxonica allow you to discover the names of the stylesheet parameters? I'd like to get all the parameters passed to transform:transform from XQL, not knowing in advance what the parameters are which have been passed.


Solution

  • To find out what parameters are declared in the stylesheet, the s9api API gives you XsltExecutable.getGlobalParameters().

    However you seem to be doing the opposite: rather than the application discovering what parameters the stylesheet wants, you're wanting the stylesheet to discover what parameters the application has supplied.

    I would suggest that you declare a single parameter called say "options" or "params" whose value is a map. You can then discover what key-value-pairs are contained in the supplied map using map:keys().