Version 6 of XLST

Updated 2004-06-15 04:09:05

Shouldn't this rather go on XSLT ? - RS LV it appears so to me - about the only place on google that I see XLST is on pages that later say that it was a typographic error.

I started this page to capture an example of using XLST with Tcl from the Tcl News Group. Glenn Halstead

Posted by Miko le pepe <[email protected]> on 12/06/2004 20:50

To invoke an extension in an XSL stylesheet, first declare the extension in your Tcl script. For example:

::xslt::extension add http://www.zveno.com/Example ::example

Then use the normal XSLT extension mechanism. The XML Namespace matches the extension to the registered Tcl namespace (NB. the stylesheet author is free to choose any prefix for the extension namespace). For example,

 <xsl:stylesheet version='1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
     xmlns:eg='http://www.zveno.com/Example'
    extension-element-prefixes='eg'>

   <xsl:template match='/'>
     <xsl:text>Result of calling extension is "</xsl:text>
     <xsl:value-of select='eg:myfunc("foo")'/>
     <xsl:text>".
 </xsl:text>
   </xsl:template>

 </xsl:stylesheet>

This stylesheet would result in the following Tcl script being evaluated:

 ::example::myfunc foo

Miko la honte

---

SRB: 2004-06-15: Added Tcl script requirement and modified stylesheet to include extension-element-prefixes attribute.