
November 23rd, 2002, 04:44 PM
|
|
Junior Member
|
|
Join Date: Sep 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Dealing with text and internal tags
I have a document with "<para>" elements containing text that need some massaging and are output as javascript variable values like so:
<xsl:template match="para">
someArray[someArray.length]='<xsl:value-of select="normalize-space(translate('.','a','A'))" />';
</xsl:template>
(The javascript doesn't concern us here; neither do the details on the translation or the whitespace handling.)
Trouble is, the <para> sometimes contains markup like the html list tags (OL, UL, LI), and I need the text (assigned to the javascript variable) to keep these tags inside the text string itself. For example, the input document might have
<para>
This is some para text
<ul>
<li> this is the first list element </li>
<li> this is the second list element</li>
</ul>
This is some other paragraph text
</para>
Since I also need to apply the "massaging" of the para text I am confused how to do this.
If someone can tell me how to construct the relevant templates I would be very very grateful. It seems that I need templates for <ol> and <ul> and <li> but I am not sure how to (a) copy those nodes, (b) get the resulting TOTAL text for the <para> nodes that contain them, and (c) assign the result to the javascruipt variable.
Help!
|