Jeni's XSLT Utilities: Markup
Copyright (c) 2000 Dr Jeni Tennison.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.1 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts and
no Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".
Markup Utility
The Markup Utility is a utility for finding and
changing words and phrases within some text. You can use it to:
highlight important terms in your text
link phrases to other pages
search and replace words within some text
Instructions
Download the stylesheet into the same directory as your stylesheet.
Import the markup.xsl stylesheet into your stylesheet:
<xsl:import href="markup.xsl" />
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:
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:
There are a few extra options that you can set as parameters for the 'markup' template, namely:
words-onlytruetrueonly whole words should be marked up (separated by
punctuation)falseany matching occurrence should be marked up, whether whole word or not.first-onlyfalsetrueonly the first occurence of a word in a piece of text should be marked upfalseall occurrences of a word in a piece of text should be marked upmatch-casefalsetrueonly occurences where the case matches exactly should be marked upfalseall occurences of the word should be marked up, regardless of case