xsl-list
[Top] [All Lists]

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

2006-05-08 11:59:26
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!

I use: Saxon 8.7.1, without validation, with XSLT 2.0.

Sample XSLT (root tag removed):

<xsl:stylesheet version="2.0" ....>
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <!--- using includes and imports -->
  <xsl:include href="import-parameters.xslt" />
  <!-- some more parameters -->
  <xsl:param name="ignore-comments" select="'true'" />
  <xsl:param name="field-separator" select="';'" />
  <xsl:template match="/" >
      ... etc ...
  </xsl:template>
</xsl:stylesheet>


Thanks to you all for reading!
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>
--~--