Markup Utility

The Markup Utility is a utility for finding and changing words and phrases within some text. You can use it to:


  1. Download the markup.xsl stylesheet into the same directory as your stylesheet.
  2. Import the markup.xsl stylesheet into your stylesheet:

    <xsl:import href="markup.xsl" />
  3. Call the template 'markup' with two parameters: text being the text to be marked up, and phrases being the phrases to be marked up within it:

    <xsl:call-template name="markup">
      <xsl:with-param name="text" select="." />
      <xsl:with-param name="phrases" select="/doc/keywords/keyword" />
  4. Create templates in 'markup' mode that match the keyword nodes and do the marking up. These can use the 'word' parameter to give the actual term that's being marked up:

    <xsl:template match="*" mode="markup">
      <xsl:param name="word" />
      <a href="{@id}.html">
        <xsl:value-of select="$word" />

There are a few extra options that you can set as parameters for the 'markup' template, namely:

$words-only [= true]
$first-only [= false]
$match-case [= false]

More Information

/xslt/utilities/markup.xml by Jeni Tennison; generated using SAXON 6.5 from Michael Kay