<<<?xml version="1.0">>>

# This is a snippet of XSLT that uses pxslcc's built-in XSLT
# shortcuts.  To convert it into the more-common XML form,
# use the following command:
#
#    pxslcc --indent --xslt xsl-stylesheet-01s.pxsl > xsl-stylesheet-01s.xsl

xsl:stylesheet \
  -version=1.0 \
  -extension-element-prefixes=func \
  -xmlns:xml=http://www.w3.org/XML/1998/namespace \
  -xmlns:mcf=http://moertel.com/xsl/1.0/functions \
  -xmlns:func=http://exslt.org/functions \
  -xmlns:xsl=http://www.w3.org/1999/XSL/Transform

  func:function -name=mcf:vertical-menu
    param menu
    param target-absloc
    func:result
      div -class=vmenu
        div -class=vmenu-items
          for-each $menu/*
            if self::menu
              copy-of mcf:vertical-menu(.,$target-absloc)
            if <(<{self::title or self::menu-item}>)>
              variable menu-absloc mcf:absloc()
              variable mm-item-id \
                mcf:maximal-matching-item($menu,$target-absloc)
              if self::title
                variable title mcf:menu-title($menu,$target-absloc)
                choose
                  when generate-id()=$mm-item-id
                    div -class=vmenu-title-selected
                      apply-templates $title
                  otherwise
                    div -class=vmenu-title
                      a -href={mcf:menu-link($menu-absloc)}
                        apply-templates $title
              if self::menu-item
                choose
                  when generate-id()=$mm-item-id
                    div -class=vmenu-item-selected
                      apply-templates
                  otherwise
                    div -class=vmenu-item
                      a -href={mcf:menu-link($menu-absloc)}
                        apply-templates
