RE: xsl self-documentation - weave

Subject: RE: xsl self-documentation - weave
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Tue, 27 Jun 2000 12:50:07 +0100
With the summary below then, suggest we split the problem
into the two domains,
the 'weave' solution and
the 'trace' solution.

Perhaps id which is being referred to by the subject heading?

I take particlular note of your comment that 'trace' is much
more often used than 'weave'.

Since perhaps the weave solution is already partly in hand
with the solutions offered, perhaps that's the one to focus
on initially?

I'll add an example below from Norm Walsh's stylesheets.

Unsure how Norm uses them, but I'm guessing he's weaving
rather than tracing.


Regards, DaveP



1. from param.xsl

<xsl:variable name="html.stylesheet"></xsl:variable>

<doc:variable name="html.stylesheet" xmlns="">
<refpurpose>Name of the stylesheet to use in the generated HTML</refpurpose>
<refdescription>
<para>The name of the stylesheet to place in the HTML
<sgmltag>LINK</sgmltag>
tag, or the empty string to suppress the stylesheet <sgmltag>LINK</sgmltag>.
</para>
</refdescription>
</doc:variable>


and 2. from xref.xsl

<doc:template name="xpointer.idref" xmlns="">
<refpurpose>Extract IDREF from an XPointer</refpurpose>
<refdescription>
<para>The <function>xpointer.idref</function> template returns the
ID portion of an XPointer which is a pointer to an ID within the current
document, or the empty string if it is not.</para>
<para>In other words, <function>xpointer.idref</function> returns
<quote>foo</quote> when passed either <literal>#foo</literal>
or <literal>#xpointer(id('foo'))</literal>, otherwise it returns
the empty string.</para>
</refdescription>
</doc:template>

<xsl:template name="xpointer.idref">
  <xsl:param name="xpointer">http://...</xsl:param>
  <xsl:choose>
    <xsl:when test="starts-with($xpointer, '#xpointer(id(')">
      <xsl:variable name="rest" select="substring-after($xpointer,
'#xpointer(id(')"/>
      <xsl:variable name="quote" select="substring($rest, 1, 1)"/>
      <xsl:value-of select="substring-before(substring-after($xpointer,
$quote), $quote)"/>
    </xsl:when>
    <xsl:when test="starts-with($xpointer, '#')">
      <xsl:value-of select="substring-after($xpointer, '#')"/>
    </xsl:when>
    <!-- otherwise it's a pointer to some other document -->
  </xsl:choose>
</xsl:template>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread