Subject:Dynamic Transformations Author:Jon Mowry Date:11 May 2006 07:04 AM Originally Posted: 11 May 2006 06:46 AM
I'm trying to create an XSLT stylesheet that will convert from an input structure to an output structure, but without having prior knowledge of what those formats are. The input to the XSL transformer would contain three parts: 1) The INPUT_DOCUMENT tag contains the input format that I would like to convert. 2) The OUTPUT_FORMAT tag contains the structure that I want the INPUT_DOCUMENT to be converted to. 3) The CONVERSION tag contains individual MAPPING tags that define how the Input data should be mapped to the output structure. Here's an example:
Obviously, this would be an easy solution if I knew exactly what the input and output structures looked like, but I want to be able to take any input and any output format with a mapping of how to convert one to the other.
Any ideas would be appreciated.
At the moment, I'm stuck on using a variable to store an XPATH. Here's a code snippet:
I've tried wrapping the variable name in brackets in the xsl:value-of 'select' attribute, but the transformer just complains. Is there any way to substitute the variable into the "value-of" statement FIRST, before the "value-of" gets evaluated?
Subject:Dynamic Transformations Author:(Deleted User) Date:11 May 2006 08:42 AM
Hi Jon,
Unfortunately, the XSLT standard doesn't provide for such a functionality. There are extension functions available from certain XSLT processors, like Saxon (saxon:evaluate) and Xalan (xalan:eval) that you may want to try.