HTML to XSLT Converter (C#)

Application project
12 May 2012

Last update (17.03.2013)

  • Fixed some parsing bugs when parsing HTML to XSLT. Might be more bugs, but it looks like it is more stable now.
  • Added tabbing functionality
  • Added hotkeys
  • Fixed a bug that created unnecessary line breaks at the top of the textfield

The program

Created this little converter to make it easier at work.

As a web developer a lot of my time is used at converting HTML prototypes to XSLT syntax, and then put it into our CMS system.

With this program I can save a lot of time and effort by skipping the boring XSLT typing of elements and attributes.

The converter have three ways of importing the HTML

  • Drag and drop a html file from your computer into the input field and hit the Load button
  • Input a url to a webpage and hit the Load button
  • Copy HTML from Source and paste it into the rich text field.

If you want to edit the HTML before converting it you can do that in the rich text field before starting the conversion. When you use the Load functions the HTML is automatically cleaned up to create line breaks and making it more readable and easier to edit. If you copy in HTML manually you can push the Clean up HTML button to make it easier to edit.

When everything is good to go you can just push the big green button, and things should be done. Copy it back to where ever you need it

You can also add a namespace (under options) that will be put inside alle the value-of blocks that are generated.

When in the XSLT mode you will also have the possibility to add tabs. This is to make it easier to pasting the content into where you want, without having to tab it on place (Can't tab in Tridion, so this is mostly created for this purpose).

You also have the possibility when in the XSLT mode to click on some hotkeys at the bottom. These will work as an easy way to copy paste XSLT (or Tridion) functionality without typing to much. (You can select what download you want below)

Note! This program uses RegExp to transform the HTML, which is not a 100% bulletproof way of reading and editing HTML. So don't allways expect it to be 100% correct. But it should give you a good foundation to work on.

You have to be logged in to download the project files!
If you are interested in the project files then contact me