XML is a way to represents datas in a human readable and compuer parsable way.
It is used (mostly) as a way to exchange datas between systems, or to transmit them.
XML can be transformed to html, text or another form of xml by the use of an XSL transformation engine.
So, in itself, XML don't so anything.
It's not a language, it's not a program.
I personally use it when I build my sites, to separate the datas of the pages and the display of them.
My php pages output xml, and I apply a stylesheet to them to create html pages.
This, is the datas of a web page:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML>
<?xml-stylesheet href="/xsl/com.dating.index" type="text/xsl"?>
<ROOT>
<GENERAL>
<title>XMLDate</title>
<lng>fr</lng>
<iso>CH</iso>
<languages>
<lang>
<code>de</code>
<trad>Allemand</trad>
</lang>
<lang>
<code>en</code>
<trad>Anglais</trad>
</lang>
<lang>
<code>fr</code>
<trad>Français</trad>
</lang>
<lang>
<code>it</code>
<trad>Italien</trad>
</lang>
</languages>
<user>
<uid></uid>
<userName/>
<email/>
<gndr/>
<gndrSearch/>
<zodiac>CAPRICORN</zodiac>
<country/>
<aboutMe/>
</user>
</GENERAL>
<DATAS/>
</ROOT>
<!-- Generation time: 0.0173239707947 -->
and this is the style sheet applied to it:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:js="/js">
<xsl:output method="html" encoding="UTF-8" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
standalone="yes" omit-xml-declaration="yes"
/>
<!--com.webalis.open_html
08.11.2007, ts, Init
doctype-public="-//W3C//DTD HTML 4.01//EN"
doctype-system="http://www.w3.org/TR/html4/strict.dtd"
-->
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="/ROOT/GENERAL/title"/></title>
<link rel="stylesheet" type="text/css" href="/css/base.css"/>
<link rel="stylesheet" type="text/css" href="/css/profiles.css"/>
<link rel="stylesheet" type="text/css" href="/css/tabs.css"/>
<link rel="stylesheet" type="text/css" href="/css/header.css"/>
<link rel="stylesheet" type="text/css" href="/js/calendar/calendar-win2k-cold-1.css" />
<script type="text/javascript" src="/js/X.js"/>
<script type="text/javascript" src="/js/rounded.js"/>
<script type="text/javascript" src="/js/webJs.js"/>
<script type="text/javascript" src="/js/global.js"/>
<script type="text/javascript" src="/js/calendar/calendar.js"/>
<script type="text/javascript" src="/js/calendar/lang/calendar-{/ROOT/GENERAL/lng}.js"/>
<script type="text/javascript" src="/js/calendar/calendar-setup.js"/>
<script type="text/javascript">
</script>
<xsl:call-template name="SCRIPTS"/>
<xsl:call-template name="LINKS"/>
</head>
<body>
<xsl:apply-templates select="ROOT"/>
</body>
</html>
</xsl:template>
<xsl:template match="ROOT">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="GENERAL"/>
<!-- FROM INCLUDE com.dating.utils -->
<!-- com.dating.utils
5.12.2007 init
17.12.2007, Added template profile
Used by => browse profiles
-->
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:template name="profile">
<div class="userCont">
<xsl:attribute name="class">
userCont
<xsl:choose>
<xsl:when test="gender='Un homme'">
userM
</xsl:when>
<xsl:otherwise>
userF
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<a href="/user/{uid}"><xsl:value-of select="username"/></a>
<xsl:choose>
<xsl:when test="pic!=''">
<img src="/img/user/{pic}" alt="trad key userPic not existant" title="trad key userPic not existant"/>
</xsl:when>
</xsl:choose>
<p>
Sexe: <xsl:value-of select="gender"/><br/>
Cherche: <xsl:value-of select="gendersearch"/>
</p>
<p>
<xsl:value-of select="aboutme" />
</p>
</div>
</xsl:template>
<!-- END INCLUDE com.dating.utils-->
<!-- com.dating.index
028.11.2007, ts, init
-->
<xsl:template name="SCRIPTS"/>
<xsl:template name="LINKS"/>
<xsl:template match="DATAS">
<!-- FROM INCLUDE com.dating.header -->
<!-- com.dating.header
028.11.2007, ts, init
-->
<div id="divHeader">
<!-- FROM INCLUDE com.dating.loginBox -->
<!--com.dating.loginBox.xsl
28.11.2007, ts, init
19.12.2007, ts, removed the bottom <br>
-->
<div id="divLogin" class="rounded" style="float:left">
<xsl:variable name="User" select="/ROOT/GENERAL/user"/>
<xsl:choose>
<xsl:when test="$User/uid>0">
<xsl:variable name="Zodiac"><xsl:value-of select="translate($User/zodiac,$ucletters,$lcletters)"/></xsl:variable>
<p style="padding:0 5px;">
Bonjour <xsl:value-of select="$User/userName"/>.<br/>
Bienvenue sur XMLDATE!<br/>
<img src="/img/zodiac/{$Zodiac}_small.gif" width="32" alt="{$Zodiac}" title="{$Zodiac}"/>
</p>
<ul>
<li>
<a href="/my/">Votre page perso.</a>
</li>
<li>
<a href="/actions/logout">Vous déconnecter.</a>
</li>
</ul>
</xsl:when>
<xsl:otherwise>
<form id="frmLogin" method="post" action="/actions/login" js:ajax="on" onsubmit="return false;">
<table>
<tr>
<th>
Pseudo:
</th>
<td>
<input type="text" name="inpTxtUserLog" id="inpTxtUserLog" />
</td>
</tr>
<tr>
<th>
Mot de passe:
</th>
<td>
<input type="password" name="inpPwdPassLog" id="inpPwdPassLog" />
</td>
</tr>
</table>
<p>
<input type="submit" value="GO!" style="float:rigth"/>
<span style="clear:both"/>
</p>
</form>
</xsl:otherwise>
</xsl:choose>
</div>
<!-- END INCLUDE com.dating.loginBox-->
<!-- FROM INCLUDE com.dating.nav -->
<div class="rounded" id="divNav">
<ul>
<li>
<a href="/">Page d'acceuil</a>
</li>
<li>
<a href="/browse/">Profils d'utilisateurs</a>
</li>
<li>
<a href="/ads/">Annonces</a>
</li>
</ul>
</div>
<!-- END INCLUDE com.dating.nav-->
<!-- FROM INCLUDE com.dating.langSwitcher -->
<!--com.dating.langSwitcher
28.11.2007, ts, init
-->
<div id="divLngSwitch" class="rounded">
<xsl:for-each select="/ROOT/GENERAL/languages/lang">
<xsl:sort select="code"/>
<div class="lang">
<xsl:if test="code=/ROOT/GENERAL/lng">
<xsl:attribute name="class">lang selected</xsl:attribute>
</xsl:if>
<a href="?LNG={code}" title="{trad}"><xsl:value-of select="code"/></a>
</div>
</xsl:for-each>
<br style="clear:both" />
</div>
<span style="clear:both" />
<!-- END INCLUDE com.dating.langSwitcher-->
<br style="clear:both"/>
</div>
<br/>
<!-- END INCLUDE com.dating.header-->
<!-- FROM INCLUDE com.dating.footer -->
<!-- com.dating.header
028.11.2007, ts, init
-->
<div id="divFooter">
<p>
© webalis.com
-
<a href="/signup.php">Inscription</a>
</p>
</div>
<!-- END INCLUDE com.dating.footer-->
</xsl:template>
<!--com.webalis.close_html
08.11.2007, ts, Init
-->
</xsl:stylesheet><!-- CACHED ON 2008-01-21 19:53:18.013818 -->
Which result in the page there:
http://dating.webalis.com/?LNG=fr