The following tip was sent to me by Ben Cline, and is posted verbatim. Thanks Ben.
Ben writes …
I found something lacking in the Macromedia documentation and nearly everything I’ve read about CF. It’s the use of XSL parameters. I found a way to successfully do this, and have tried to send something to Macromedia about this, but have never gotten a response back. As you know, using XSL parameters is something that vastly improves the usability of XSL transformations.
All of the code in this tip will use cfscript. If you are unfamiliar with xml, xsl, and xpath, refer to xml documentation.
The key to increasing the productivity of xsl stylesheets comes through xsl:params. Most xml implementations of xml parsers and transformers carry the option of loading up an xsl sheet with parameters.
Before using xsl, it is important that xml be defined as the source document. After the xml has been created, xsl will be made for transforming the xml. Creating an xsl transform to execute the same every time betrays the flexibility that xsl brings to xml. Content output from an xsl transform should instead be dynamic. This can be accomplished by sending variable data into xsl through the use of parameters. During the process of creating an xsl page, the variables for holding dynamic information can be created at the top of an xsl file. The code below shows a parameter within xsl for text color. Notice no value is placed on the xsl:param line, usually indicated by select=””.
Leave a Reply