written by Manuel Schnitger, 10. October 2011
Some weeks ago I planned to visit a partner in order to provide some information regarding different topics and the partner sent me a mail with a list of topics he wanted to speak about previously. One line of this mail was:
“Question: How can we produce valid XHTML code. (Note: Tidy and Delivery Server will probably not work together)”
As I didn’t exactly know whether this statement was true or not, I asked a colleague with much deeper understanding of the Delivery Server and Tidy and got a document that I would like to share with you. Maybe this is as helpful for you as for me ;).
In order to publish the Dynaments from CMS to LiveServer correctly you first have to change in the HTML project variant settings the setting of WCCompliance from HTML to XHTML. Why we have to do this? Consider the following correct dynament code.
<rde-dm:attribute mode="for-each" attribute="companies" source="user" alias="company"> <rde-dm:attribute mode="read" attribute="company" source="context"/> </rde-dm:attribute>
If we declare the rde-dm:attribute both as a new-blocklevel-tag and as a new-empty-tag in our HTML tidy config file we receive the following output after running tidy:
<rde-dm:attribute mode="for-each" attribute="companies" source="user" alias="company"> <rde-dm:attribute mode="read" attribute="company" source="context">
This output is obviously different from the input ;)
If we declare the rde-dm:attribute only as a new-blocklevel-tag we receive the following output. (Note: It makes sense to try this declaration cause
<rde-dm:A/>
and
<rde-dm:A></rde-dm:A>
are equivalent.)
<rde-dm:attribute mode="for-each" attribute="companies" source="user" alias="company"> <rde-dm:attribute mode="read" attribute="company" source="context"> </rde-dm:attribute>
We distinguish between block tags as <rde-dm:attribute>…other tags…</rde-dm:attribute> and empty tags as <rde-dm:cps … />. But some dynaments as the <rde-dm:attribute> dynament for example, are existing both as block and as empty tags. This is important for our declaration. We consider the following cases:
If you don’t want to distinguish between some block and empty tags, declare all tags as new-blocklevel-tags in the HTML tidy configuration file. Because <rde-dm:A/> and <rde-dm:A>…</rde-dm:A> are equivalent, it still works.
Unfortunately no correction is provided, as the following example shows (suppose the red slashs of the nested rde-dm:attribute dynament and the rde-dm:otherdynament are missing):
If you would use this as the tidy input:
<rde-dm:attribute mode="for-each" attribute="companies" source="user" alias="company"> <rde-dm:attribute mode="read" attribute="company" source="context" /> <rde-dm:attribute> <rde-dm:otherdynament />
The output would like this:
<rde-dm:attribute mode="for-each" attribute="companies" source="user" alias="company"> <rde-dm:attribute mode="read" attribute="company" source="context"> <rde-dm:attribute> <rde-dm:otherdynament> </rde-dm:otherdynament> </rde-dm:attribute> </rde-dm:attribute> </rde-dm:attribute>
The following sample code displays the content of a Tidy configuration file, where Tidy can produce valid XHTML code but doesn’t touch/modify the DynaMents which were placed within the template code:
// sample tidy file quiet: yes clean: yes indent: auto indent-spaces: 2 indent-attributes: yes wrap-attributes: yes wrap: 72 markup: yes output-xhtml: yes input-xml: no show-warnings: yes numeric-entities: yes quote-marks: yes quote-nbsp: yes quote-ampersand: no break-before-br: no uppercase-tags: no uppercase-attributes: no char-encoding: latin1 force-output:true new-blocklevel-tags: rde-dm:import,rde-dm:metadata,rde-dm:reporting,rde-rd:import-list,myparam1,myparam2,rde-rd:attribute,rde-dm:repository,rde-dm:if,type,rde-rd:from,rde-rd:query-fulltext,rde-rd:body,rde-dm:target,height,rde-dm:webcomponent,rde-rd:password-expires,rde-rd:created-from,border,rde-dm:query-verity,key,rde-dm:attribute,text,mark-as-read,keywords,align,width,constraints,answer,rde-dm:container,properties,msg,rde-dm:process,rde-dm:webservice,rde-dm:link,rde-dm:livelink,m:dogooglesearch,start,rde-rd:reference,rde-dm:message,safesearch,soap-env:envelope,rde-dm:constraint,rde-rd:group,rde-rd:query-property,comment,filter,rde-rd:language,rde-rd:status,rde-dm:iolet,rde-rd:username,rde-dm:rdb,rde-rd:attachment,rde-rd:user-filter,attribute,constraint,rde-dm:query,rde-rd:validto,rde-rd:import,rde-rd:recipient,rde-rd:last-logon-to,another,rde-dm:include,author,rde-rd:role,rde-rd:validfrom,rde-rd:recipients,parameter,rde-rd:role-param,rde-rd:subject,rde-rd:created-to,name,rde-rd:name,attachments,rde-dm:query-cis,rde-rd:email,rde-dm:param,rde-dm:else,rde-dm:image,rde-rd:reply-to,rde-rd:param,attachment,rde-rd:last-logon-from,rde-dm:user,rde-rd:content,rde-rd:attributes,soap-env:body,rde-rd:soap-message,rde-rd:query-native,maxresults,periodfrom,q,rde-dm:script,attributes,rde-dm:reference,rde-dm:content,parameter1, new-empty-tags: lr,br,oe,rde-dm:reddot,ie,rde-dm:cps,rde-dm:wrapper-template,restrict,rde-dm:portal,rde-dm:link-param, // additional setting for Word 2000 word-2000:yes // setting for kicking out font tags drop-font-tags: yes drop-empty-paras: yes bare: true doctype: strict drop-proprietary-attributes: true logical-emphasis: true quote-marks: true indent: false quote-nbsp: true
Note: As the content of the configuration file comes from a project, you might want to delete some things which don’t appear in your project and possibly add other things.
As some German politicians where involved in affairs regarding plagiarismI’d like to point out that the information in this article were provided by our German Service team (Notably by Dominic Seiffert). ;)
Source: Tidy does(n’t) work with the Delivery Server
© copyright 2011 by Manuel Schnitger