InfoPath RichTextField and CDATA MS InfoPath 2003

L

Leila

Hi,

I have an infoPath form which allows users to insert news articles.

My main body field is a richtext field. I assumed that by using this
type of field, the user could then use the fomatting buttons at the
top of the form to make text bold, italic, etc. This all looks great
on the infopath form, but when I try to display the body field on my
HTML page (using XSLT), all the formatting is lost.

I am assuming that the html tags in the body field (<b>...</b>,
<i>...</i> and so on) are being interpretted as XML so they are not
getting sent to the browser.

After some reading, I see that one solution would be to insert a CDATA
tag into the xml file, as in:

<news>
<article>
<title>TITLE OF STORY</title>
<date>16/08/2004</date>
<body><![CDATA[ I assume I should insert the <b>cdata tags</b> in my
XML doc like this in order to have my <i>HTML</i> tags preserved so
that the broswer can interpret them as <b>HTML</b>, not <i>XML</i>!
]]</body>
..
..
..
</article>
</news>

Then in my XSLT, I should do something like this:
<xsl:value-of select="news/article/body" disable-output-escaping="yes"
/>

However, how can I alter my infoPath form so that it puts the CDATA
tag around the body field??? Is this possible?

Obviously I am not working with the XML documents directly; I am
creating them through Infopath!

Any suggestions would be most welcome!

Leila
 
B

Brian Teutsch [MSFT]

I believe you're using the XSLT to output HTML incorrectly. You can use the
XHTML in an InfoPath form without change (CDATA actually isn't supported).
Sorry I can't do a proper example for you right now, but I think the big
error is coming from using value-of instead of copy-of. Copy-of will move
the whole XML subtree, just like you want. Also, it might not hurt to use
output-type="html" in the XSL as well.

Thanks,
Brian
 
L

Leila

Brian Teutsch said:
I believe you're using the XSLT to output HTML incorrectly. You can use the
XHTML in an InfoPath form without change (CDATA actually isn't supported).
Sorry I can't do a proper example for you right now, but I think the big
error is coming from using value-of instead of copy-of. Copy-of will move
the whole XML subtree, just like you want. Also, it might not hurt to use
output-type="html" in the XSL as well.

Thanks,
Brian

Brian, That worked perfectly! Thank you very much for this useful tip!

Leila
 

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

Top