Subject: [xsl] Defining XSLT functions in XSLT 1.0 From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Tue, 20 Feb 2001 11:21:48 +0000 |
Hi, This mail is a summary of the various options open to us in terms of declaring/defining user extension functions in XSLT, in XSLT 1.0. The discussions on this topic should be limited to functionality available in basic XSLT 1.0. That means no xsl:script, and no implicit RTF -> node-set conversion. The aim is to identify the extension elements and functions that are necessary to enable us plebs to declare functions in XSLT 1.0. Naturally arguments that involve forwards-compatibility with XSLT 1.1 are worthwhile, but those that rely on functionality that cannot be introduced until XSLT 2.0 are not. At the bottom of this mail is a questionnaire so anyone can vote for the different options that we've discussed even if they don't want to voice their opinion on the list. To summarise the designs that have been suggested so far in terms of this questionnaire: --- saxon:function --- With saxon:function, the following apply: 1. a new element is used to declare functions 2. it is called saxon:function 3. it is at the top-level of the stylesheet ... 5. a functions' name is indicated by a name attribute 6. a function's namespace is indicated by the prefix on the name 7. a function's arguments are specified with xsl:param ... 9. a function's return value is given through a new element 10. it is called saxon:return 11. it can return values through both a select attribute and its content 12. it can occur anywhere aside from within xsl:variable or xsl:for-each 13. xsl:variable, xsl:if, xsl:choose and xsl:for-each are allowed within saxon:function 14. messages are allowed within saxon:function 15. they cannot terminate cleanly 16. there is an additional conditional function 17. it is called saxon:if 18. there is an additional function for converting RTFs to node sets 19. it is called saxon:node-set --- --- David Rosenborg's proposal --- follows broadly saxon:function as above, except with exsl:function. Then... 9. a function's return value is given through a new element 10. it is called exsl:result 11. it can return values through both a select attribute and its content 12. it can occur only as the last child of exsl:function 13. only xsl:variable is allowed within exsl:function 14. messages are not allowed within exsl:function ... 16. there is an additional conditional function 17. it is called exsl:if --- The pertinent thing about Dimitre's proposal to this part of the debate is that it involves specifying arguments by attributes on the exsl:function element (Q7a). If we decide to do it that way, we need to think about how the attribute values are parsed as parameter declarations. I've left that for another stage if there are enough votes for Q7a. --- Questionnaire --- Naturally I will be using XSLT to analyse the voting :) Please vote on the following questions by posting me privately an email with a piece of XML in the form: <vote poll="defining" version="1.0" email="mail@xxxxxxxxxxxxxxxx" Q1="b" Q2="a" ... /> Please vote on every question, even if it depends on an assumption that you don't agree with - it means that even if others disagree on the major point, you can still have your say on the minor point. If you don't have an opinion, then leave the attribute blank or don't include it. If you want to suggest a new option, then write it in as the value of the attribute. If you change your mind, then send me an email with a piece of XML of the form: <retract poll="defining" version="1.0" email="mail@xxxxxxxxxxxxxxxx" ... /> specify attributes for the questions you want to change your answers to. Q1: What element should be used to declare functions? Q1a: xsl:template Q1b: a new element Q2 (assumes Q1b): What should the new element be called? Q2a: exsl:function ... others? Q3: Should there be a wrapper element around the function definitions? Q3a: yes Q3b: no (should be declared at the top level) Q4 (assumes Q3a): What should the wrapper element be called? Q4a: exsl:script Q4b: exsl:binding Q4c: exsl:functions Q5: How should the name of the function be indicated? Q5a: name attribute ... others? Q6: How should the namespace of the function be indicated? Q6a: prefix on name (i.e. name is a QName) Q6b: prefix in separate attribute on function Q6c: namespace URI in separate attribute on function Q6d: prefix in attribute on wrapper element Q6e: namespace URI in attribute on wrapper element [Note: choices b-e require additional decisions on names] Q7: How should the arguments for the function be indicated? Q7a: attributes on the function-declaring element Q7b: xsl:param elements within the function-declaring element Q7c: a new element within the function-declaring element [Note: choice a requires additional decisions on the form of the attributes] Q8 (assumes Q7c): What should the element for declaring arguments be called? Q8a: exsl:arg ... others? Q9: How should values be returned? Q9a: always as an RTF (i.e. function creates nodes that are returned) Q9b: with a new element Q9c: with a mixture of Q9a and Q9b Q10 (assumes Q9b or Q9c): What should the new element be called: Q10a: exsl:return Q10b: exsl:result ... others? Q11 (assumes Q9b or Q9c): How should the new element return values: Q11a: select attribute Q11b: content Q11c: both Q11a and Q11b permitted, but not both at once (i.e. follows syntax of xsl:variable, xsl:param, xsl:with-param) Q12 (assumes Q9b or Q9c): Where should the new element be permitted: Q12a: only as the last child of the function-declaring element Q12b: as any descendant of the function-declaring element Q12c: as any descendant of the function-declaring element aside from within of xsl:variable Q12d: as any descendant of the function-declaring element aside from within xsl:variable or xsl:for-each Q13: What control elements should be allowed as content: Q13a: xsl:variable Q13b: xsl:variable, xsl:if and xsl:choose Q13c: xsl:variable, xsl:if, xsl:choose and xsl:for-each Q14: Should messages (through xsl:message) be allowed within functions? Q14a: yes Q14b: no Q15 (assumes Q14a): Should messages be able to terminate within functions? Q15a: yes Q15b: no Q16: Should an additional conditional function be introduced as well? Q16a: yes Q16b: no Q17 (assumes Q16a): What should the additional conditional function be called? Q17a: exsl:if ... others? Q18: Should an additional RTF -> node-set function be introduced as well (now, and in this namespace, given XSLT 1.1 will do it automatically)? Q18a: yes Q18b: no Q19 (assumes Q18a): What should an RTF -> node-set function be called? Q19a: exsl:node-set Q19b: exsl:nodeset ... others? Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] RE: RE; Re: RE: syntax sugar , Dimitre Novatchev | Thread | Re: [xsl] Defining XSLT functions i, Jeni Tennison |
Re: [xsl] Re: Designs for XSLT func, Dimitre Novatchev | Date | Re: Designs for XSLT functions (Was, Francis Norton |
Month |