If you’ve been developing XSLT for Umbraco, you’ve probably already done your share of
<textarea><xsl:copy-of select="." /></textarea> to examine the XML you’re transforming... let’s get rid of that habit and do something much better.
With this simple package you’ll have instant access to all published nodes, selectable by id or document type - many browsers support viewing XML in a nice color-coded fashion, so now you can let IE6 do the only thing it’s good at and leave it open on your secondary screen :-)
The package installs a Template, an XSLT Macro and a Config - the files are:
~/masterpages/XMLDump.master ~/xslt/XMLDump.xslt ~/config/XMLDump.config
Because installing XMLDump will allow anyone to see the entire data structure of your site, I've decided to require an extra step that makes you, the developer, responsible for switching the feature on and off. You can do that in two different ways:
XMLDump will look for a property called
xmldumpAllowedIPs recursively upwards from the start node selected for viewing (see below) and if that property contains the IP address of the current request (the REMOTE_ADDR server variable), it will render the XML. So you need to add a textstring property to your "website" Document Type and subsequently fill in your IP address on the corresponding content node before XMLDump will render anything.
As of version 0.9.3 you can also add the IP address(es) to the
XMLDump.config file in the
configfolder - there should be an empty
<xmldumpAllowedIPs> element in there which you can fill in.
After you've successfully installed the package, you can use the altTemplate syntax to view the underlying XML of your Umbraco website - just open your site in a web browser and go to the following URL:
Or, if you're not using Directory URLs:
You can also view the XML for a specific page by doing the same thing, e.g.:
XMLDump allows a set of options on the query string and conveniently displays what they are at the top of its output.
dictoption for Dictionary items.
mntpoption too. Add count of matched nodes to output for
mntp, changed some logic in
Chriztian Steinmeier, April 2014 (Initial version: November 2009)