Re: [xsl] Dynamic, configurable transformations / was: Re: Wrap changing element sequence into container: with 'for-each-group'?

Subject: Re: [xsl] Dynamic, configurable transformations / was: Re: Wrap changing element sequence into container: with 'for-each-group'?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 30 Jan 2007 15:53:42 +0100
Yves Forkl wrote:

My idea was to define an XML language that would describe the desired transformation for each p style, and to retrieve the transformation rules specified as XML from inside the application-specific style sheet that just imports the module with the unmodified "p" template.

try XSLT, it is an XML language that can be used to describe any desired transformation.



I fear this might all just be a crazy idea... Which way would go to make XSLT dynamic in the sense of parametrizing transformations like this?


Would you consider it a better idea to dynamically generate an application-specific style sheet containing classical push style templates, in my case stuff like match="p[@style='value1'] ? That would at least allow me to group adjacent siblings into a common container, I suppose.

In general, when you need a kind of customization that cannot be handled by parameters, it is common (?) to create a meta-stylesheet which creates a specific stylesheet with all your rules.


However, I may not understand fully what you mean. When I need many customizations, I tend to create a settings file in XML and read it in with doc() or document(). The settings file itself can be a result of a transformation. Also, the settings file, once read with document(), can be processed using normal template matching rules.

In other situations, I have resorted to list parameters (i.e., having a parameter with a value of "1,12,16,3,4", which can mean the columns to be sorted). Using tokenize() you can easily get your data from them.

Optional imports, if that is your primary problem of customization, can be achieved by either carefully looking at precedence rules, or by utilizing the 'use-when' with system properties. The system properties can be set from the host language, giving you even further customization possibilities.

Finally, you can think of extension functions like saxon:parse() that take a stylesheet as argument.

-- Abel

Current Thread