docbook-apps

Re: [docbook] emphasis role and $depth mod 2 = 1

  • 1.  Re: [docbook] emphasis role and $depth mod 2 = 1

    Posted 05-28-2007 23:10
    [moving this over to docbook-apps where such matters are discussed]

    The "depth" here is the depth of nesting of emphasis elements. In a
    regular emphasis element, the text is italic. If you put an emphasis
    inside an emphasis, then that text should be normal within the italic. The
    mod 2 alternates them.

    The dot.count template is a clever trick to compute the number of
    ancestors. The dots it is counting are not in the text, but in a number
    generated using xsl:number with level="multiple". This generates a number
    like 1.1 for a nested emphasis and 1.1.1 for doubly nested. It counts
    those dots to get the depth of nesting to use in the mod expression.

    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    bobs@sagehill.net