www.webdeveloper.com
Results 1 to 3 of 3

Thread: XML webpage support

  1. #1
    Join Date
    Jan 2011
    Posts
    1

    XML webpage support

    Hi, i am a student studying xml and we are asked to create a webpage by using xml and i think xsl for the style sheet. How ever we have not studied how to create a webpage.

    so what i need is to be able to do a webpage the same way as in html but in xml with a style sheet and everything just a webpage with a table to insert images and text into and a button to link it to another page.

    can any one help need to do it by this week thanks

  2. #2
    Join Date
    Jan 2011
    Posts
    9
    post an attachment with source files (xml, images, etc.) and more specific requirements

  3. #3
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    I did something like this on ultimater.net:
    At the time of this post, the XML source code is:
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <?xml-stylesheet href="/skinning-files/themes/default.xsl" type="text/xsl" ?>
    <webpage title="Ultimater's Homepage">
    <meta http-equiv="refresh" content="0;url=/noxml?uri=aHR0cDovL3VsdGltYXRlci5uZXQv" />
    <content><![CDATA[
    I trashed my coding coding blog that used to be here on the index page because I didn't like wordpress. Aside from vulnerabilities, security holes and the spam, the software is too overused in my opinion to be considered safe. I am coding my own personal system from scratch to replace it. I don't plan on sharing the full source word-for-word but I plan to blog about it - the design and concepts - when I find the time.
    ]]></content>
    </webpage>
    The XSL file reads:
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><xsl:value-of select=".//@title" /></title>
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <link rel="icon" href="http://www.ultimater.net/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="http://www.ultimater.net/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="http://www.ultimater.net/skinning-files/themes/default/indexpage.css" />
    </head>
    <body>
    <div id="container1">
    <table id="container2" cellspacing="0" cellpadding="0" style="height:100&#37;;background-color:rgb(214,207,245);">
    <tr>
    <td valign="top">
    <center>
    <table id="table1" style="margin-top:50px"><tr><td>
    <fieldset><legend>Notice</legend><blockquote class="tt"><tt>
    <xsl:apply-templates />
    </tt></blockquote></fieldset>
    </td></tr></table>
    </center>
    </td></tr></table>
    </div>
    </body>
    </html>
    </xsl:template>
    
    <xsl:template match="content">
    <xsl:value-of select="." />
    
    </xsl:template>
    </xsl:stylesheet>
    My site idea is still in the experimental stage, the META refresh tag for example will render to the browser if the browser treats it as an HTML tag then would forward the user to
    http://ultimater.net/noxml?uri=aHR0c...ltYXRlci5uZXQv which contains a base64 encoded representation of the referrer. You can see the meta tag render in Firefox by changing the content-type to text/html rather than the text/xml the page uses:
    http://ultimater.net/?Content-Type=t...+charset=utf-8
    IE accepts either and doesn't complain thus to test its fallback support you could try "text/xhtml" which seems to work for IE.

    The noxml page uses htaccess to run PHP to parse the XML and apply the XSL stylesheets found on the page like a browser would then spit out the generated HTML to the client. I'd share the source but I don't think the PHP is stable enough yet plus you will notice the page takes forever to load due to the XML and XSL parsing server-side. It would be possible to have PHP cache results so it can generate the HTML quicker but I'm not happy enough with my approach yet to code anything overkill yet. Besides you probably don't need backdoor support for HTML anyways.

    Hope my page helps.
    Last edited by Ultimater; 01-13-2011 at 12:28 PM.

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles