[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: template return value
Thanks Jeni, That's helps a lot . ----- Original Message ----- From: "Jeni Tennison" <jeni@xxxxxxxxxxxxxxxx> To: "Charly" <cohana@xxxxxxxxxxxxxxx> Cc: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Wednesday, December 12, 2001 10:13 AM Subject: Re: template return value > Hi Charly, > > > Is it possible to write functions in XSL. If not is there a way > > around . I need to call a template and store the output (or result) > > into a variable. > > You can call the template from the body of the xsl:variable, as you've > been shown. The trouble with this method is that the variable gets > assigned a result tree fragment. Usually that doesn't matter (because > result tree fragments are automatically and mostly correctly converted > to strings or numbers when you use them in a context that requires a > string or number). However, you can't return a node set from a > template. > > So if the result you want is a node set, you have two options. > > Firstly, you can return a result tree fragment containing copies of > the nodes, then convert the result tree fragment to a node using an > extension node-set() function (e.g. exsl:node-set(), xalan:nodeSet(), > msxsl:node-set()). These functions return the root node of the result > tree fragment as a node set, so you usually need to step down to its > child to get the information you want. > > Secondly, you can use an extension that allows you to define > extension functions yourself, and return node sets from these > extension functions. For example, you could use func:function (see > http://www.exslt.org/functions) in Saxon, 4XSLT, libxslt or jd.xslt, > msxsl:script in MSXML or xalan:component/xalan:script in Xalan. > > Cheers, > > Jeni > > --- > Jeni Tennison > http://www.jenitennison.com/ > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|