Marking words in a text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hvid Hat

    Marking words in a text

    Hello

    How should I go about marking certain words in a text? I've got a list of
    words:

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="Mark.xsl" ?>
    <Words>
    <Word>
    <Acronym>XML</Acronym>
    <Description>eX tensible Markup Language</Description>
    </Word>
    <Word>
    <Acronym>SGML </Acronym>
    <Description>St andard Generalized Markup Language</Description>
    </Word>
    <Word>
    <Acronym>ISO</Acronym>
    <Description>In ternational Organization for Standardization </Description>
    </Word>
    </Words>

    I want the words (acronyms) above to be marked within bold-tags in the text
    below:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:styleshe et version="1.0"
    xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"<xsl: output method="xml"
    version="1.0" encoding="UTF-8" indent="yes"/ <xsl:template match="Words">
    XML is a simple, very flexible text format derived from SGML (ISO 8879)
    </xsl:template>
    </xsl:stylesheet>

    Can someone help me on my way? :-)
  • Joseph J. Kesselman

    #2
    Re: Marking words in a text

    Peter Flynn wrote:
    You'd have to use a recursive
    template to isolate each word in turn and test it against your list,
    which would be slow.
    Or have the stylesheet invoke an extension function written in a
    language better suited to this task.

    Personally, I think you should make this the author's responsibility.
    Maybe use the (slow) find-words-and-tag-them as an authoring tool to
    help them do so... but encourage them to use appropriate markup in the
    first place rather than trying to reverse-engineer their text.

    Comment

    Working...