ShoX reference documentation. Index


XSL element template

Default keyword for template is match or fun.

ShoX syntax:

match [other attributes] (@select) {template}

ShoX syntax:

fun [other attributes] (@match) {template}

Example

        match(zap){
            <b>apply()</b>
        }

        match(zap[@id='u2']){
            <b>apply()</b>
        }

        match[name='zap'](zap){
            <b>apply()</b>
        }

        match[xmlns:zap='http://whatever.com'](zap){
            <b>apply()</b>
        }
	

Example

        fun(fibonaci){
            par NrOfRabits='0'{}
            switch {
                case ($par>1) {
                    var generation1 = call fibonaci {
                        wpar NrOfRabits='$NrOfRabits - 1'{}
                    }
                    var generation2 = call fibonaci {
                        wpar NrOfRabits='$NrOfRabits - 2'{}
                    }
                    val($generation1 + generation2)
                }
                default {
                    text"1"
                }
            }
        }
	

See also call-template.

XSL documentation of element xsl:template.