<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:template match="/page">
        <html>
            <head>
                <title><xsl:value-of select="@title"/></title>
                <link rel="stylesheet" href="css/stylesheet.css" />

            </head>
                <body >
                <div class="page">
                 <div class="navigation">
                    Site Navigation:
                    <xsl:apply-templates select="//navigation"/>
                    <BR/>This Page:
                    <xsl:apply-templates mode="navigation" select="//content"/>
                    <BR/>




                </div>
				<xsl:apply-templates select="//replacedBy"/>
                <xsl:apply-templates select="//content"/>
                <xsl:call-template name="footer" />
                </div>
            </body>
       </html>

    </xsl:template>

	<xsl:template match="replacedBy">
	<div id="replacedBy"><h1>Page Moved</h1>
		This page has been replaced by the page located at
		<xsl:element name="a">
			<xsl:attribute name="href" >
				<xsl:value-of select="@href" />
			</xsl:attribute>
			<xsl:value-of select="@href" />
		</xsl:element>
		<br/><br/>
		
		You should be automatically redirected, and the referring URL you came from has been logged so we'll update it soon.
		 		
		<noscript>
			Looks like you don't have javascript enabled, so you're gonna have to <xsl:element name="a">
			<xsl:attribute name="href" >
				<xsl:value-of select="@href" />
			</xsl:attribute>
			click
			</xsl:element>.
		</noscript>
		<br/><br /><br />
		<center>
		<img src="/images/ajax-loader.gif" />
		</center>
		<script type="text/javascript">
			window.location = "<xsl:value-of select="@href" />";
		</script>
		
	</div> 
	</xsl:template>

    <xsl:template match="navigation">
            <xsl:apply-templates />
    </xsl:template>

    <xsl:template match="page">
        <xsl:element name="a">
            <xsl:attribute name="href">
                <xsl:value-of select="@page"/>
            </xsl:attribute>
            <xsl:value-of select="@title"/>
        </xsl:element>
    </xsl:template>

    <xsl:template match="link">
        <xsl:element name="a">
            <xsl:attribute name="href">
                <xsl:value-of select="@url"/>
            </xsl:attribute>
            <xsl:value-of select="@title"/>
        </xsl:element>
    </xsl:template>

    <xsl:template match="content">
        <div class="content">
            <xsl:apply-templates />
        </div>
    </xsl:template>

    <xsl:template match="article[@type='img']">
        <xsl:element name="img">
            <xsl:attribute name="src"><xsl:value-of select="@url"/></xsl:attribute>
        </xsl:element>
    </xsl:template>

    <xsl:template match="article[@type='html']">
        <div class="article">
            <h1>
                <xsl:value-of select="@heading"/>
            </h1>
            <xsl:element name="a">
                <xsl:attribute name="name"><xsl:value-of select="@heading"/></xsl:attribute>
            </xsl:element>
            <xsl:copy-of select="*"/>
        </div>
    </xsl:template>

    <xsl:template match="article[@type='blog']">
        <div class="article">
            <h1>
                <xsl:value-of select="@heading"/>
            </h1>
            <xsl:element name="a">
                <xsl:attribute name="name"><xsl:value-of select="@heading"/></xsl:attribute>
            </xsl:element>
            <xsl:copy-of select="*"/>
        </div>
        <div class="blog" name="blog">

        </div>
    </xsl:template>

    <xsl:template name="blogHeader">
        <script language="JavaScript" src="js/blog.js" type="text/JavaScript"></script>
    </xsl:template>


    <xsl:template match="article[@type='iframe']">
        <div class="article">
            <h1>
                <xsl:value-of select="@heading"/>
            </h1>
            <xsl:element name="a">
                <xsl:attribute name="name"><xsl:value-of select="@heading"/></xsl:attribute>
            </xsl:element>
            <xsl:copy-of select="*"/>

        <xsl:element name="iframe">
            <xsl:attribute name="src"><xsl:value-of select="@url"/></xsl:attribute>
            <xsl:attribute name="class">iframe_article</xsl:attribute>
            <xsl:attribute name="scrolling">no</xsl:attribute>
        </xsl:element>
        </div>
    </xsl:template>

    <xsl:template match="article[@type='pictures']">
        <div class="article">
            <h1>
                <xsl:value-of select="@heading"/>
            </h1>
            <xsl:element name="a">
                <xsl:attribute name="name"><xsl:value-of select="@heading"/></xsl:attribute>
            </xsl:element>

            <div class="thumbnails">
                <xsl:apply-templates mode="thumbnails" />
            </div>
            <hr />
            <div class="pictures">
                <xsl:apply-templates mode="pictures" />
            </div>
        </div>
    </xsl:template>


    <xsl:template match="picture" mode="thumbnails">
        <xsl:element name="a">
            <xsl:attribute name="href">#<xsl:value-of select="@img"/></xsl:attribute>
            <xsl:element name="img">
                <xsl:attribute name="src">
                    <xsl:value-of select="@img"/>
                </xsl:attribute>
                <xsl:attribute name="height">60</xsl:attribute>
            </xsl:element>
        </xsl:element>
    </xsl:template>

    <xsl:template match="picture" mode="pictures">
        <xsl:element name="a">
            <xsl:attribute name="name"><xsl:value-of select="@img"/></xsl:attribute>
        </xsl:element>

        <xsl:element name="img">
            <xsl:attribute name="src">
                <xsl:value-of select="@img"/>
            </xsl:attribute>
        </xsl:element>
        <br />
    </xsl:template>

    <xsl:template match="article">
        <div class="article">
            <h1>
                <xsl:value-of select="@heading"/>
            </h1>
            <xsl:element name="a">
                <xsl:attribute name="name"><xsl:value-of select="@heading"/></xsl:attribute>
            </xsl:element>
            <xsl:apply-templates />
        </div>
    </xsl:template>


    <xsl:template match="embed">

    </xsl:template>

    <xsl:template mode="navigation" match="article">
        <xsl:if test="@heading">
            <xsl:element name="a">
                <xsl:attribute name="href">#<xsl:value-of select="@heading"/></xsl:attribute>
                <xsl:value-of select="@heading"/>
            </xsl:element>
        </xsl:if>
    </xsl:template>

    <xsl:template match="p">
        <p>
            <xsl:if test="@image">
                <xsl:element name="img">
                    <xsl:attribute name="src">
                      <xsl:value-of select="@image"/>
                    </xsl:attribute>
                </xsl:element>
            </xsl:if>
          <xsl:apply-templates />
        </p>
    </xsl:template>


    <xsl:template match="links">
        <div class="links">
            <h2><xsl:value-of select="@title"/></h2>
            <xsl:apply-templates mode="links" />
        </div>
    </xsl:template>

    <xsl:template mode="links" match="link">
        <div class="link">
        <xsl:element name="a">
            <xsl:attribute name="href">
                <xsl:value-of select="@url"/>
            </xsl:attribute>
            <xsl:value-of select="@title"/>
        </xsl:element>
        <xsl:if test="@description">
        <div class="linkDescription">
            <xsl:value-of select="@description"/>
            <xsl:copy-of select="*"  />
        </div>
        </xsl:if>

        <xsl:apply-templates mode="links" />

        </div>
    </xsl:template>

    <xsl:template mode="links" match="page">
        <div class="link">
        <xsl:element name="a">
            <xsl:attribute name="href">
                <xsl:value-of select="@page"/>
            </xsl:attribute>
            <xsl:value-of select="@title"/>
        </xsl:element>
            <xsl:if test="@description">
                <div class="linkDescription">
                    <xsl:value-of select="@description"/>
                </div>
            </xsl:if>
        <xsl:apply-templates mode="links"/>
        </div>
    </xsl:template>


    <xsl:template name="header">
        <img src="images/title.jpg" />
        <!--<div class="header">
            <span class="name">Marc Hughes.</span><span class="dotcom">com</span>
        </div>-->
    </xsl:template>

    <xsl:template name="footer">
        <div class="footer">
            <a href="http://www.flashyourspace.com/">Flash Your Space</a>
            <a href="http://www.rogue-development.com/">Rogue Development</a>
            <a href="http://www.osflash.org/flexdesigner/">Flex Designer</a>
            <a href="http://www.marc-hughes.com/">Personal website</a>
        </div>        
        <div class="copyright">
            Copyright 2006 by Marc Hughes
        </div>
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
		<script type="text/javascript">_uacct = "UA-737326-2";urchinTracker();</script>
    </xsl:template>

</xsl:stylesheet>