Highlight Text

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

    #1

    Highlight Text

    Basically I have some nodes that represent paragraphs

    <para>Sally Sells Sea Shells Down By The Sea Shore.</para>

    in there, some of the text are wrapped with identifier
    <para>Sally <hlt>Sells</hlt> Sea Shells <hlt>Down</hlt> By The Sea
    Shore.</para>

    I need to change the output of those to be an html element so I can
    apply a css style to it.

    I have a template to output the text of the para node
    I am then calling a template for the hlt node.
    But it processes ALL of the hlt nodes and not each one as it comes
    across it.
    My output comes out like:

    <p>Sally <span>Sells</span><span>Down </span> Sea Shells By The Sea
    Shore.</p>

    Is there any way to accomplish this so it looks like:
    <p>Sally <span>Sells</span> Sea Shells <span>Down</span> By The Sea
    Shore.</p>

    Thanks

    Brian
  • Johannes Koch

    #2
    Re: Highlight Text

    Mac wrote:[color=blue]
    > Basically I have some nodes that represent paragraphs
    >
    > <para>Sally Sells Sea Shells Down By The Sea Shore.</para>
    >
    > in there, some of the text are wrapped with identifier
    > <para>Sally <hlt>Sells</hlt> Sea Shells <hlt>Down</hlt> By The Sea
    > Shore.</para>
    >
    > I need to change the output of those to be an html element so I can
    > apply a css style to it.[/color]

    <xsl:template match="para">
    <p>
    <!-- This applies templates for all the text and element child nodes -->
    <xsl:apply-templates/>
    </p>
    </xsl:template>

    <xsl:template match="hlt">
    <span>
    <xsl:apply-templates/>
    </span>
    </xsl:template>

    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)

    Comment

    Working...