[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to retrieve global parameters names and their

Subject: Re: 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
first names welch
On 5/8/06, Abel Braaksma Online <abel.online@xxxxxxxxx> wrote:
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!

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.