The page or section element to generate links for.
The link trail leading to $node.
The ID of the root page.
This template outputs lists of links, where each list is a path of topic links that leads to $node. Each link list is output as a link element in the Mallard namespace with an xref attribute pointing to the target page or section. Each link has a title element with type="sort" providing the sort title of the target page or section.
Each link element may also contain another link element providing the next link in the trail. Each of these links also contains a sort titles and may also contain another link.
The results are not sorted when returned from this template. Use xsl:sort on the nested sort titles to sort the results. The output is a result tree fragment. To use these results, call exsl:node-set on them.
This template calls itself recursively. It finds the guide links for $node using mal.link.guidelinks. It then calls mal.link.linktrails on each guide, wrapping $trail with a link to the guide as the new $trail parameter.
If there are no guide links for $node and $node is a section element, this template calls itself on the containing page, wrapping $trails with a link to that page. This link element has the attribute child="section" to indicate the link from it to its child is not a topic link.
Recursion stops when the ID of $node is $root. Link trails are only output if they reach $root, which is mal.link.default_root by default.