XSLT Creation of Add'l Content with embedded HTML

Topics: Developer Forum, User Forum
Jun 2, 2008 at 10:59 PM
Hey All,

I know this is really more of an XSLT question than SHFB, but I'm hoping someone may be able to help me here because of the tie to SHFB. The net is that I have a very flat XML file with a structure like:

<class>
    <action>
        <param></param>
        <param></param>
        <remarks>
            <b>This is html code!</b>
            <ol>
                <li>Bullet 1</li>
                <li>Bullet 2</li>
            </ol>
        </remarks>
    </action>
</class>

XSLT transforms the above to a XML.topic file for consumption by the SHFB Additional Content component and it works fine EXCEPT for the fact that I can't get the HTML <Remark> element to go over with HTML tags intact.  Of course the output I want is:

.....
<topicremarks>
            <b>This is html code!</b>
            <ol>
                <li>Bullet 1</li>
                <li>Bullet 2</li>
            </ol>
<topicremarks>

I have:

  1. Wrapped the HTML in a CDATA container. Data comes out in one long paragraph with no tags.
  2. Maintained the CDATA wrapper and used a "value-of" statement that turned off escaping (creates NO remarks output):  

    <

    xsl:value-of select="$Vvar109_Remarks_string" disable-output-escaping="yes"/>

I'm stuck on this. Any suggestions would be appreciated!!

Regards,
Keith

 

Coordinator
Jun 2, 2008 at 11:38 PM
Try something like this:

  <xsl:template match="remarks">
    <xsl:copy-of select="node()"/>
  </xsl:template>

Using "node()" makes it dump the content of the node.

Eric
Jun 3, 2008 at 12:46 AM
Bingo, worked like a charm - I must have done six or seven searches on this and didn't run across even one reference to "node". Thanks as usual. If you're ever in Seattle (maybe you're local?), I'll buy you a cold one!

EWoodruff wrote:
Try something like this:

  <xsl:template match="remarks">
    <xsl:copy-of select="node()"/>
  </xsl:template>

Using "node()" makes it dump the content of the node.

Eric



Coordinator
Jun 3, 2008 at 2:24 AM
Edited Jun 3, 2008 at 2:25 AM
I'm fairly close (a few hours away).  I live in Medical Lake which is just outside Spokane, WA.

Eric