text nodes and tags inside text

wxdqz

New Member
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>
I want the javascript array element to contain the "<ul>" and "<li>" tags as literals (as well as the text in those nodes).
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 text for the <para> nodes that contain them, and (c) assign the result to the javascript variable.
Help!
 
Back
Top