Exercise XSLT/BinomTrees

Topic: Computing with XSLT; Recursive named templates

A binomial tree Bk is an ordered tree defined as follows: B0 is a single node, and Bk+1 consists of a root node that has binomial trees Bk, ..., B0 as its immediate subtrees (in order from left to right). (Binomial trees are used as an efficient implementation of priority queues.) Write XSLT template rules that create an XML representation of binomial tree Bk for a given value of k.

Example (to compute B3):

      java -jar saxon.jar binomialTree.xslt binomialTree.xslt k=3
      <B3>
        <B2>
          <B1>
            <B0/>
          </B1>
          <B0/>
        </B2>
        <B1>
          <B0/>
        </B1>
        <B0/>
      </B3>
Use file binomialTree.xslt as a starting point. (It also shows how to generate elements with a computed type name; see Section 7.1.2 of the XSLT Recommendation.)