Developer forum

Forum » Templates » New features in paragraph setup templates in xslt

New features in paragraph setup templates in xslt

Nicolai Høeg Pedersen
Reply

Based on the input from a blog post about xml output from Dynamicweb we've made a change to the output of paragraph setup templates xml.

The blopost can be read here:
http://www.saucer.dk/2010/10/dynamicwebs-xml-for-paragraphsetup-and-how-i-would-change-it/

**** The reply ****
Thanks for "bitching" in public - If you did not speak up we would not be able to improve...

We've looked at your suggestions and have built something in Dynamicweb for paragraph setup templates that should meet your whishes.

Medias are now available in a loop as well in the existing way. So when using a xslt template a loop looking like this is available:

<loop name="Media">
 <item>
   <Media><![CDATA[<a href="Default.aspx?ID=126"><img src="Files/Billeder/AutumnLeavesSmall.jpg" border="0" alt="" width="300" height="225" class="paragraphsetupimage" /></a>]]></Media>
   <MediaClean>Files/Billeder/AutumnLeavesSmall.jpg</MediaClean>
   <Link>Default.aspx?ID=126</Link>
 </item>
  </loop>

Looping the paragraphs is not an option due to the existsing architecture, but tags have been extended to have a type attribute:

<TemplateLink5></TemplateLink5>
  <TemplateParagraphHeader1 Type="Header">More on Dynamicweb 2</TemplateParagraphHeader1>
  <TemplateParagraph1 Type="Text">
 <![CDATA[<h1>Dynamicweb</h1>]]>
  </TemplateParagraph1>
  <TemplateParagraphColumn1 Type="Column">
 <![CDATA[<h1>Dynamicweb</h1>]]>
  </TemplateParagraphColumn1>

Let me hear your comments on this - it can be ready for 7.2 out soon.


Replies

 
Reply
Hey Nicolai

I find it a bit wrong to call ParagraphTemplate1 type like  "Type="Text" since it is not a text but more like a HTML Content. Calling it "Text" might give some confusion.

Maybe Type="TemplateContent" is a better description?

But beside everything else, then I'm sure that this improvement on the XML output will make your XSLT templates even more powerfull. 
 
Nicolai Høeg Pedersen
Reply
You might have a point  Text = text without markup.

Changed it to "Content" and also changed type for columns to "Content" since it is the same - just a stack of content.
 
Reply
 True, but please don't call TemplateParagraphColumn1  and TemplateParagraph1 same since that will conflict with the match loop. 

maybe 

TemplateParagraph1 type="Contect"
TemplateParagraphColumn1 type="ColumnContect"

I can't remember what TemplateParagraphColumn1 was used for, since I never used it. But I find it better when you have some kind of order/groupe condition that you can call. 
 
Reply
I only have one wish:

Follow the rules which You have implemented elsewhere, for instance in the Datapublishing part of Dynamicweb.

That way the people implementing and working with the XML documents generated from Dynamicweb do not need to understand several different kinds of logic across different parts of Dynamicweb.

/Sten Hougaard

 
Reply
A while back we discussed the opportunity of having TemplateV2.Ouput() return XML similar to that generated by SaveXML. Did you make any attempts towards that, or was it too far out:)

BR.
Lars
 
Nicolai Høeg Pedersen
Reply
@sorensen
After you call template.output, the XML is available in the xmldocument property of the template object.

@sth
Dynamicweb uses the same generation of xml document everywhere in the system except for navigations. So there are basically 2 set of rules. Some older modules does not have loops though - that is the biggest difference.
 
Reply

The xmldocument property is only available through the API, so we can only use that approach for our own extentions. I remember we discussed an approach using e.g. a querystring paramter or another environment variable would cause the Output method to return the XML hather than the merged HTML.

Thanks for the presentation today. Looks very exciting, and I'll be submitting some change requests shortly:)

BR.
Lars

 
Reply
Hi Lars,

If I understood you correctly...

The system uses several different types of templates during the page rendering: Master + page (layout), paragraph, [module]. Which one of them would you expect to return an XML rather then HTML when you pass something in the query-string ? 

- Pavel
 
Reply
Hi Pavel,

All of them. The SaveXML parameter in query string actually does it already, but rather than saving an XML file, I'd like Dynamicweb to return the XML to the browser.

You're very welcome to give me a call for further discussion on this subject:-)

BR.
Lars
 
Reply
Why not just a single paragraph? In which case would we need the complete page as XML?

You could make a request like:
/Default.aspx?ID=1&PID=123&out=XML 

Then DW could return the given paragraph and its module content as XML (Content-Type = text/xml). Any other content would be ignored.

Maybe I have misunderstood the problem :)

/Morten
 
Reply
Well, at some point, Mr. Bengtson, you'll need something besides the paragraph output, and then you'll be sorry that only paragraph output is returned as XML;-)

And since saving all XML is already possiblem, it would be an easy addition to make.

BR.
Lars
 
Reply
... And you'd be able to acheive that with M=ModuleSystemName&PID=xx:)

BR.
Lars
 
Reply
Well, OK, Mr. Sørensen :)

However, it seems like the current SaveTemplateXml=true requires that you have selected an XSLT template. It would be great if we could get the content as XML regardless of the template type.

Even if we select an XSLT template for the page, the content from paragraphs and modules (DwContent) is still HTML, unless we choose XSLT templates on every single paragraph and module.

BR Morten
 
Reply
I couldn't agree with you more, sir;-)

HR.
Lars

 

You must be logged in to post in the forum