Welcome to WebmasterWorld Guest from

Forum Moderators: httpwebwitch

Message Too Old, No Replies

Custom XML MarkUp Language

Creating your own web markup language.

8:39 am on May 16, 2011 (gmt 0)

Just out of curiosity and to have something to play around with:
I'm wondering is it possible to create your own web markup language like (X)HTML using XML and XSL, DTD and/or CSS.
And could be made to work without converting the markup to HTML.

Found a few pages on the net about using XML with XSL to convert your XML to HTML, but that kind of defeats the purpose doesn't it.
12:07 pm on May 16, 2011 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You can create any "language" you want by extending XML; For instance a Schema that's all <car> with <part> and <gas> and <exhaust>; that's not HTML, it's markup for something else. I wouldn't call it a new language (it's XML) but it's not HTML, so there it is.

You can argue that every XML Schema is its own "language".

You can in fact, use XSL to transform XML into anything you want like JSON or CSV or just a paragraph of madlibs text, or anything you care to invent
12:20 pm on May 16, 2011 (gmt 0)

So one could per say create a "language" as complicated as XHTML with the proper knowledge and skills using XML etc...?

And in that case would browsers be capable of rendering it?

I should get an e-book on XML Schemas... :)
1:26 pm on May 16, 2011 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Browsers can only render (x)HTML. That's why XSL is so often used to transform from XML into HTML; so you can view an XML document in a browser.

If you were viewing the XML document with some other device or reader (client), you might have a different XSL for rendering the XML into whatever markup is appropriate for that client. (eg, Acrobat, Spreadsheet, Flash, speech reader, printer, teletype machine, or whatever).

The document you'll load into the browser is XML, but the layout you'll see in the browser window is the HTML that was generated by the XSL transformation.

CSS is just the icing

Here's a forum library post that I refer to for client-side XSL formatting:

If you load a "raw" XML document into a browser, you'll usually see just text.

If you provide your own XSL, that's when you get pretty formatting on the screen so your XML document doesn't look like a pile of nested brackets and tags.

However IE has a built-in XSL that renders XML docs into a pretty expandable/collapsible tree. I think Firefox has (or used to have) a built-in XSL for RSS feeds (RSS is an extension of XML).

So you can definitely create a "page" of XML that renders in a browser, which consists of nothing but <car> and <part> nodes. But in the XSL, you'll transform those into HTML elements like <body> and <table> and <div> and <p>.

There are as many XML Schemas as there are ways to organize information. Infinite. There are some standard ones, like HTML and VML and FBML, but you can certainly invent your own: "eXtensible" - that's what the "X" in XML stands for. When you create a Schema, you're "extending" XML and creating a new language with your own set of tags.

As you're experimenting, your goal should be to describe the relationships in your data as nicely as possible; for instance put your <page> nodes inside a <book> node and your <book> inside a <library>. Or, put your <lesson> into a <class> and <class> inside a <session> or <semester>.

The XML should be your rawest, most accurate and nicely organized representation of the data.

XSL is used to transform the data into something temporary, human-readable, interactive, that which is to be consumed by the client device, reader, processor, etc.
1:44 pm on May 16, 2011 (gmt 0)

Makes sense, will check it out...