Use Separate Elements

<doc:template xmlns:doc="http://..." xmlns="http://..."
              id="xpath.location">
<p>Calculate an XPath child-sequence to
an element node.</p>
<h1>Synopsis</h1>
<h2>Public Parameters</h2>
<dl>
<dt>node</dt>
<dd><p>The target node. If unspecified, the context
node is used.</p></dd>
</dl>

<h1>Description</h1>
<p>The xpath.location template calculates
the absolute path from the root of
the tree to an element node, by default,
the context node.</p>
</doc:template>
<xsl:template name="xpath.location">
  <xsl:param name="node" select="."/>
  <xsl:param name="path" select="''"/>

  <xsl:variable name="next.path">
    <xsl:value-of select="local-name($node)"/>
    ...
</xsl:variable>
  • The code is still code.

  • Documentation is nearby.

  • Documentation is in XML.

  • Documentation is tenuously attached to the source.