cancel
Showing results for 
Search instead for 
Did you mean: 

HTML in a Web Form

kramoutar
Champ in-the-making
Champ in-the-making
Hi there,

I have a web form with one element, xs:string, that can be populated with either text or HTML.  My rendering template takes the info in this element and wraps it in an XML node for integration with a web app.  I'm noticing that upon save, Alfresco surrounds the text with <p>…</p> AND that even with disable-output-escaping set to yes, if HTML is entered, the tags aren't escaped, they're rendered into &lt; instead of <.

Here's an example:

Content entered into Web Form field:
<p>Thank you for creating an account. Take a tour of the account features that may make your shopping experience more enjoyable.</p>
      <dl>
       <dt>Order History</dt>
       <dd>
        <p>Review previous orders, reorder items that you have purchased previously, and review the status of your orders.</p>
        <p><a href="OrderHistoryView">Start Now</a></p>
       </dd>
      
       <dt>Wishlist</dt>
       <dd>
        <p>Create a wishlist of items that you wish to purchase.</p>
        <p><a href="InterestItemDispay">Start Now</a></p>
       </dd>

       <dt>Address Book</dt>
       <dd>
        <p>Provide your address information now to speed up your checkout process.</p>
        <p><a href="AddressBookView">Start Now</a></p>
       </dd>

       <dt>Billing Information</dt>
       <dd>
        <p>Store your credit card information in our secure system to make purchasing products a breeze.</p>
        <p><a href="#">Start Now</a></p>
       </dd>

       <dt>Account Information</dt>
       <dd>
        <p>Update your email address and account password</p>
        <p><a href="EditAccountInformationView">Start Now</a></p>
       </dd>
      </dl>
XSLT Snippet:
<xsl:value-of disable-output-escaping="yes" select="." />
Output XML Doc Snippet:
<body><p>      &lt;p&gt;Thank you for creating an account. Take a tour of the account features that may make your shopping experience more enjoyable.&lt;/p&gt;<br />      &lt;dl&gt;<br />       &lt;dt&gt;Order History&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Review previous orders, reorder items that you have purchased previously, and review the status of your orders.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="OrderHistoryView"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;<br />       <br />       &lt;dt&gt;Wishlist&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Create a wishlist of items that you wish to purchase.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="InterestItemDispay"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;</p> <p>       &lt;dt&gt;Address Book&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Provide your address information now to speed up your checkout process.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="AddressBookView"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;</p> <p>       &lt;dt&gt;Billing Information&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Store your credit card information in our secure system to make purchasing products a breeze.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="#"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;</p> <p>       &lt;dt&gt;Account Information&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Update your email address and account password&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="EditAccountInformationView"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;<br />      &lt;/dl&gt;</p></body>

Can someone help me get rid of the <p> and also figure out how to escape the HTML in the output?

Thanks in advance.
3 REPLIES 3

scottf
Champ on-the-rise
Champ on-the-rise
You need to use a CDATA element to parse any html properly in your XML rendition.

For example:

If your XSLT snippet was something like this:

<xsl:element name="dummy-element">
<xsl:value-of disable-output-escaping="yes" select="." />
</xsl:element>

Then at the top of your XSL, to ensure the "dummy-element" element is surrounded by CDATA tags you would have something like:
  <xsl:output method="xml" version="1.0"   encoding="UTF-8" indent="yes" media-type="text/html" cdata-section-elements="dummy-element"/>

Hope that helps.

mathew
Champ in-the-making
Champ in-the-making
hello All
I am Mathew currently I am working on project of Asp.net And I want to use some HTML tag in my website but iam not aware of HTML so please give some instruction.I want to use HTML for attractive web page,give me some pdf file link which i can download it..
Thanks

kramoutar
Champ in-the-making
Champ in-the-making
Thanks ScottF; I will try that.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.