Highlight Text

Discussion in 'XML' started by Mac, Sep 25, 2003.

  1. Mac

    Mac Guest

    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
    Mac, Sep 25, 2003
    #1
    1. Advertising

  2. Mac wrote:
    > 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.


    <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.)
    Johannes Koch, Sep 26, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephajn Craig

    Highlight Text based on certain criteria

    Stephajn Craig, Jul 7, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    355
    Axel Dahmen
    Jul 8, 2003
  2. Robert M
    Replies:
    1
    Views:
    663
    Curt_C [MVP]
    Jan 5, 2004
  3. =?Utf-8?B?Tmlja3k=?=

    How to highlight some text in an iframe by script?

    =?Utf-8?B?Tmlja3k=?=, Nov 23, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    799
    bruce barker
    Nov 23, 2004
  4. Replies:
    1
    Views:
    508
    Adrienne Boswell
    Mar 10, 2006
  5. Replies:
    0
    Views:
    223
Loading...

Share This Page