Highlight Text

M

Mac

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
 
J

Johannes Koch

Mac said:
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top