Developer forum

Forum » Templates » How to generate XML from a page?

How to generate XML from a page?

Lise Trabjerg Pedersen
Reply
I have been asked to deliver some pages as XML, whichs has to be used in a mobile website, build outsite of Dynamicweb.

First, I need the menu from this page as xml:

http://www.herningcentret.dk/Default.aspx?ID=750&Purge=True

and a number of "shop presentations" like this:

http://www.herningcentret.dk/Butikker/Kvinder/Center-Mode.aspx

I can't figure out how to create xml of a "ordinary page", and for the first page's menu, I have tried to write the "&SaveXml=True" after the url, but didn't get any xml file in the templates/navigation folder.
(I read this link: http://engage.dynamicweb-cms.com/CMS-836.aspx?M=eCom_Catalog&PID=&ProductID=PROD17 )


I hope I can get some quick help?
/Lise

Replies

 
Sten Hougaard
Reply
 Hi Lise,
You need to make all the content elements (templates) generate XML. The best way is probertly to make XSLT versions of each involved template.
The quick and dirty way would be to make them all return all the XML using:

<xsl:copy-of select="." />


That would generate a potential huge XML document, so you probertly would not take that path.

Use Dynamicweb CMS build in to "Convert templates to XSLT"
When you have the template open you will see a function "Convert to XSLT". It will do a basic convertion of your HTML template to an XSLT template, from which you can output XML easily.

The page (layout) template need to be stripped for things like HEAD and BODY and prepared to output XML.

Another way: Using Yahoo YQL
Yahoo offers a sort of "SQL for the internet". With that you can point to a webpage and get its output as XML. That would make it possibel to do XPATH on the content XML and by doing so filter out what is needed for the mobile website. I cannot give you any specific help about this, but on the Yahoo developer site some good examples exist. You can see an example I have made where I extract the known issues of Dynamicweb CMS.

Professionel help
If you need any help with this I would be glad to help, giving you an estimate of solving the task.

/Sten Hougaard
sth@bleau.dk

Almost forgot: You can read about XSLT at dwfeatures.com: Working with XSLT in Dynamicweb.

 

You must be logged in to post in the forum