<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/styles/XMLStylesDoc_xhtml11_en.xsl"?><!DOCTYPE document SYSTEM "/schemas/XMLStyles10.dtd">
<document xmlns="http://XMLStyles.com/namespaces/styles" xmlns:xst="http://XMLStyles.com/namespaces/styles" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:date="http://exslt.org/dates-and-times">
   <noxml>
      <p xmlns="http://www.w3.org/1999/xhtml"/>
      <!-- You are viewing the source.  The following message should be ignored if you did "View Source" in your browser. -->
      <p xmlns="http://www.w3.org/1999/xhtml">
ATTENTION: XML WEB PAGES NOT SUPPORTED
   If you see this message, your current browser does not support the
   1999 XSLT 1.0 (or later) standard for XML web pages such as this one.
   Please upgrade your browser to a newer version
   that supports 1999 or later standards such as:
      Mozilla Firefox version 1.0.2 or later (GetFirefox -&gt; http://www.GetFirefox.com/)
      Netscape version 8 or later
      Safari version 1.3 or later
      Opera version 9 or later
      Microsoft Internet Explorer (MSIE) version 5 or later
   For further assistance, contact the software vendor for your browser.
   To go to the X<!-- extended HTML -->HTML version of this page click the following link:
<a href="index.html">index.html</a>
      </p>
      <p xmlns="http://www.w3.org/1999/xhtml">&#160;</p>
   </noxml>
   <path>/internet/xml/</path>
   <site>How To Guides</site>
   <logo xlink:type="simple" xlink:href="/images/howtohome.jpg" media="screen" width="240" height="34">How To Guides</logo>
   <logo xlink:type="simple" xlink:href="/images/howtoguides.jpg" media="print" width="240" height="34">How To Guides</logo>
   <logo xlink:type="simple" xlink:href="/images/howtoguidesmobile.jpg" media="handheld" width="150" height="17">How To Guides</logo>
   <navigation where="sections">
      <label>How To Guides</label>
      <link xlink:type="simple" xlink:href="/business/index.xml">Business</link>
      <link xlink:type="simple" xlink:href="/computers/index.xml">Computers</link>
      <link xlink:type="simple" xlink:href="/computers/databases/index.xml">Databases</link>
      <link xlink:type="simple" xlink:href="/internet/index.xml">Internet</link>
      <link xlink:type="simple" xlink:href="/mobile/index.xml">Mobile</link>
      <link xlink:type="simple" xlink:href="/money/index.xml">Money</link>
      <link xlink:type="simple" xlink:href="/movies/index.xml">Movies</link>
      <link xlink:type="simple" xlink:href="/computers/os/index.xml">Operating Systems</link>
   </navigation>
   <navigation where="up">
      <link xlink:type="simple" xlink:href="../">Internet</link>
      <link xlink:type="simple" xlink:href="../web/">Web</link>
      <link xlink:type="simple" xlink:href="../webdesign.xml">Web Design</link>
      <link xlink:type="simple" xlink:href="../markuplanguages.xml">Markup Languages</link>
   </navigation>
   <navigation where="subsections">
      <label>Internet</label>
      <link xlink:type="simple" xlink:href="/internet/affiliates/">Affiliates</link>
      <link xlink:type="simple" xlink:href="/internet/domains/">Domain Names</link>
      <link xlink:type="simple" xlink:href="/internet/marketing/">Internet Marketing</link>
      <link xlink:type="simple" xlink:href="/internet/isps/">ISPs</link>
      <link xlink:type="simple" xlink:href="/internet/podcasts/">Podcasts</link>
      <link xlink:type="simple" xlink:href="/internet/tcpip/">TCP/IP</link>
      <link xlink:type="simple" xlink:href="/internet/web/">Web</link>
      <link xlink:type="simple" xlink:href="index.xml">XML</link>
   </navigation>
   <section id="body" type="body">
      <pages name="index">
         <title>How To Guides for XML</title>
         <navigation where="pages">
            <label>index</label>
            <link xlink:type="simple" xlink:href="index.xml">Summary</link>
            <link xlink:type="simple" xlink:href="introduction.xml">Intro</link>
            <link xlink:type="simple" xlink:href="templates.xml">XSL Templates</link>
         </navigation>
         <h1>"How To" Guides for XML</h1>
         <page id="N1011C" name="templates">
            <title>Using XSL Templates</title>
            <label>XSL Templates</label>
            <description>How to use XSL templates to repurpose content.</description>
            <navigation where="up">
               <link xlink:type="simple" xlink:href="index.xml">XML</link>
            </navigation>
            <subpage id="mobile" name="mobile">
               <h1>How to repurpose mobile content for traditional web browsers</h1>
               <p>When content needs to be delivered to both traditional web browsers and
                  smaller mobile devices, one technique for producing content for both
                  channels from the same source is to code the content for one channel and
                  <link xlink:type="simple" xlink:href="#repurposing">repurpose</link> it for the other channel.
                  In most cases, the content for traditional web browsers already exists,
                  so the tendency is to try to repurpose that content for smaller devices.
               </p>
               <p>However, it's much easier to design the content for the smaller portable
                  devices and use XSL templates to repurpose the content for
                  larger displays by wrapping it with additional markup code.
               </p>
               <p>This technique is particularly useful for sites using a ".mobi"
                  domain name managed by the dotMobi registry, since the registry
                  <link xlink:type="simple" xlink:href="/internet/domains/dotmobi.xml#requirements">requires sites to be designed for mobile devices</link>.
                  For an example see the
                  <link xlink:type="simple" xlink:href="http://www.Sample.mobi/">Sample .mobi site</link>
               </p>
            </subpage>
            <subpage id="N10143" name="samplexhtml">
               <label>sample.xml</label>
               <h1>Sample <acronym term="Extensible Hypertext Markup Language">XHTML</acronym> file</h1>
               <p>The <acronym term="Extensible Hypertext Markup Language">XHTML</acronym> file contains the page-specific content that is delivered to all types of browsers.
                  No site-wide common elements are included, since those are put into separate templates.
               </p>
               <blockcode title="Sample XHTML file">
                  <l>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</l>
                  <l>&lt;?xml-stylesheet type="text/xsl" href="/sample.xsl"?&gt;</l>
                  <l>&lt;!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"&gt;</l>
                  <l>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</l>
                  <l>&lt;!-- Copyright (c) 2006 Accilent Corp. (http://www.Accilent.com/) for How To Guides (http://www.HowToGuides.com/). Provided AS IS; no warranties are expressed or implied. Permission is hereby granted to use and/or modify. --&gt;</l>
                  <l> &lt;head&gt;</l>
                  <l>  &lt;link rel="stylesheet" type="text/css" href="/screen.css" media="screen"/&gt;</l>
                  <l>  &lt;link rel="stylesheet" type="text/css" href="/handheld.css" media="handheld"/&gt;</l>
                  <l>  &lt;title&gt;Sample .mobi site&lt;/title&gt;</l>
                  <l> &lt;/head&gt;</l>
                  <l> &lt;body&gt;</l>
                  <l>  &lt;h1&gt;&lt;/h1&gt;</l>
                  <l>  &lt;h2&gt;Home Page&lt;/h2&gt;</l>
                  <l>  &lt;p&gt;This is the actual content that shows up on small mobile devices.  The content can include &lt;a href="http://www.Acronyms.net/terms/h/Hypertext-Transfer-Protocol/" title="Hypertext Transfer Protocol"&gt;&lt;abbr&gt;HTTP&lt;/abbr&gt;&lt;/a&gt; links to other web pages, such as:&lt;/p&gt;</l>
                  <l>  &lt;p&gt;&lt;a href="/detect.cgi?test" accesskey="d"&gt;Detect browser type&lt;/a&gt;&lt;/p&gt;</l>
                  <l>  &lt;p&gt;as well as specialized links for mobile devices with phone functions, such as:&lt;/p&gt;</l>
                  <l>  &lt;p&gt;&lt;a href="wtai://wp/mc;14123373113" accesskey="w"&gt;Call the webmaster&lt;/a&gt;&lt;/p&gt;</l>
                  <l> &lt;/body&gt;</l>
                  <l>&lt;/html&gt;</l>
               </blockcode>
               <p>See <link xlink:type="simple" xlink:href="/internet/domains/dotmobi.xml#issues">.mobi sites in Internet Explorer</link>
                  for issues displaying ".mobi" web sites in an IE browser.
               </p>
            </subpage>
            <subpage id="N10182" name="samplexsl">
               <label>sample.xsl</label>
               <h1>Sample XSL templates</h1>
               <p>Common elements that need to appear on every page throughout the site
                  would be put into templates in an XSL file referenced by the <acronym term="Extensible Hypertext Markup Language">XHTML</acronym> pages.
               </p>
               <blockcode title="sample.xsl">
                  <l>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</l>
                  <l>&lt;!-- uncomment to validate XSLT</l>
                  <l>&lt;!DOCTYPE xsl:transform SYSTEM "http://www.sample.mobi/dtd/xslt.dtd"&gt;</l>
                  <l>--&gt;</l>
                  <l>&lt;xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="html"&gt;</l>
                  <l>&lt;!-- Copyright (c) 2006 Accilent Corp. (http://www.Accilent.com/) for How To Guides (http://www.HowToGuides.com/). Provided AS IS; no warranties are expressed or implied. Permission is hereby granted to use and/or modify. --&gt;</l>
                  <l>&lt;xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" doctype-system="http://www.sample.mobi/dtd/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/&gt;</l>
                  <br/>
                  <l> &lt;xsl:template match="/"&gt;</l>
                  <l>  &lt;xsl:apply-templates select="*"/&gt;</l>
                  <l> &lt;/xsl:template&gt;</l>
                  <br/>
                  <l> &lt;xsl:template match="html:head"&gt;</l>
                  <l>  &lt;xsl:copy&gt;</l>
                  <l>   &lt;xsl:apply-templates select="@*"/&gt;</l>
                  <l>   &lt;link rel="stylesheet" type="text/css" href="/screen.css" media="screen"/&gt;</l>
                  <l>   &lt;link rel="stylesheet" type="text/css" href="/handheld.css" media="handheld"/&gt;</l>
                  <l>   &lt;xsl:apply-templates select="node()"/&gt;</l>
                  <l>  &lt;/xsl:copy&gt;</l>
                  <l> &lt;/xsl:template&gt;</l>
                  <br/>
                  <l> &lt;xsl:template match="html:body"&gt;</l>
                  <l>  &lt;xsl:copy&gt;</l>
                  <l>   &lt;xsl:apply-templates select="@*"/&gt;</l>
                  <l>   &lt;h1 style="display:inline"&gt;Sample .mobi site&lt;/h1&gt;</l>
                  <l>   &amp;#160;a working example of repurposing mobile content as explained by&amp;#160;</l>
                  <l>   &lt;a href="http://www.HowToGuides.com/internet/xml/templates.xml#mobile"&gt;&lt;img src="/images/howtoguides.jpg" width="143" height="27" alt="How To Guides logo"/&gt;&lt;/a&gt;</l>
                  <l>   &lt;p style="color: gray"&gt;This is a sample showing how templates can be used to make a web site that has been designed for mobile devices look good in a normal web browser. The important content, which you can do "View Source" to see, is put into &lt;a href="http://www.Acronyms.net/terms/e/Extensible-Hypertext-Markup-Language/" title="Extensible Hypertext Markup Language"&gt;&lt;abbr&gt;XHTML&lt;/abbr&gt;&lt;/a&gt; pages that are delivered to mobile devices, and any additional layout and styling for traditional browsers is put into templates and style sheets. Since the templates and style sheets can be reused for all pages on the site and are cached separately, this has the added advantage of reducing bandwidth requirements by as much as one half or more.&lt;/p&gt;</l>
                  <l>   &lt;hr/&gt;</l>
                  <l>   &lt;xsl:apply-templates select="node()"/&gt;</l>
                  <l>   &lt;hr/&gt;</l>
                  <l>   &lt;p&gt;Click on the following link to verify that this page conforms to the &lt;a href="http://www.Acronyms.net/terms/e/Extensible-Hypertext-Markup-Language/" title="Extensible Hypertext Markup Language"&gt;&lt;abbr&gt;XHTML&lt;/abbr&gt;&lt;/a&gt; Mobile Profile as required by the dotMobi registry Switch On! guidelines:&lt;/p&gt;</l>
                  <l>   &lt;p&gt;</l>
                  <l>    &lt;a href="http://validator.w3.org/check/referer" target="w3cvalidator"&gt;</l>
                  <l>     &lt;img src="/images/valid-xhtml10.png" alt="Valid XHTML 1.0!" height="31" width="88"/&gt;&lt;/a&gt;</l>
                  <l>    &amp;#160;</l>
                  <l>    &lt;a href="http://ready.mobi/start.jsp?uri=sample.mobi"&gt;MobiReady Report&lt;/a&gt;</l>
                  <l>   &lt;/p&gt;</l>
                  <l>   &lt;p&gt;The "Mandatory Registrant Rules" for .mobi domains states:&lt;/p&gt;</l>
                  <l>   &lt;p style="margin: 0 3em"&gt;The "Mandatory Registrant Rules" for .mobi domains states that "Requests for URIs consisting only of "example.mobi" or "www.example.mobi" must result in a response that is encoded in a format the device supports or valid &lt;a href="http://www.Acronyms.net/terms/e/Extensible-Hypertext-Markup-Language/" title="Extensible Hypertext Markup Language"&gt;&lt;abbr&gt;XHTML&lt;/abbr&gt;&lt;/a&gt;-Mobile Profile 1.0 or later released version, where "example" stands for any domain name.&lt;/p&gt;</l>
                  <l>   &lt;p&gt;For a site that satisfies these registration requirements for a .mobi domain, the W3C Validator will display:&lt;/p&gt;</l>
                  <l>   &lt;p style="margin: 0 3em; background-color: #55b05a; color: white; text-align: center; font-family: Bitstream Vera Sans, sans-serif; font-size-adjust: .53; font-size: 1.5em; font-weight: 500"&gt;This Page Is Valid -//WAPFORUM//DTD XHTML Mobile 1.0//EN!&lt;/p&gt;</l>
                  <l>   &lt;p&gt;Copyright &amp;#169; 2006 Sample .mobi.  All rights reserved.&lt;/p&gt;</l>
                  <l>  &lt;/xsl:copy&gt;</l>
                  <l> &lt;/xsl:template&gt;</l>
                  <br/>
                  <l> &lt;xsl:template match="@*|node()"&gt;</l>
                  <l>  &lt;xsl:copy&gt;</l>
                  <l>   &lt;xsl:apply-templates select="@*|node()"/&gt;</l>
                  <l>  &lt;/xsl:copy&gt;</l>
                  <l> &lt;/xsl:template&gt;</l>
                  <br/>
                  <l>&lt;/xsl:transform&gt;</l>
               </blockcode>
               <p>More sophisticated sites could have various groups of pages which are
                  similar to each other, but are different from the pages in other groups.
                  In this case, more than one level of templates would be used.
                  For each group of similar pages, a separate template would be
                  created for the common elements on the pages within that group.
                  Those templates would all import a single site-wide template containing
                  the common elements that would appear on all pages across the entire site.
               </p>
            </subpage>
            <subpage id="N101F7" name="screencss">
               <label>screen.css</label>
               <h1>Style sheet for traditional web browsers</h1>
               <blockcode title="screen.css">
                  <l>img {</l>
                  <l>   border: 0;</l>
                  <l>}</l>
               </blockcode>
            </subpage>
            <subpage id="N10205" name="handheldcss">
               <label>handheld.css</label>
               <h1>Style sheet for handheld devices</h1>
               <blockcode title="handheld.css">
                  <l>img {</l>
                  <l>   border: 0;</l>
                  <l>}</l>
               </blockcode>
            </subpage>
            <subpage id="htaccess" name="htaccess">
               <label>.htaccess</label>
               <h1>.htaccess file</h1>
               <p>To deliver the <acronym term="Extensible Hypertext Markup Language">XHTML</acronym> and <acronym term="Wireless Markup Language">WML</acronym> pages with the correct
                  <acronym term="Multipurpose Internet Mail Extensions">MIME</acronym> types,
                  you will need an .htaccess file will the following directives,
                  or their equivalent for the web server software you are using:
               </p>
               <blockcode title=".htaccess">
                  <l>DirectoryIndex index.xml</l>
                  <l>ErrorDocument 404 /pagenotfound.xml</l>
                  <br/>
                  <l>AddType application/xhtml+xml;charset=utf-8 xml xhtml</l>
                  <l>AddType text/vnd.wap.wml;charset=iso-8859-1 wml</l>
                  <br/>
                  <l>RewriteEngine on</l>
                  <br/>
                  <l>RewriteCond %{HTTP_USER_AGENT} \(compatible;[[:space:]]*MSIE[[:space:]]+[[:digit:]]+\.[[:digit:]][[:alnum:]]*;</l>
                  <l>RewriteRule ^$ http://%{HTTP_HOST}/index.xml [L,R=temp]</l>
               </blockcode>
               <p>Contrary to the HTTP standards, Internet Explorer pays more attention to the file extension than to the
                  <acronym term="Multipurpose Internet Mail Extensions">MIME</acronym> types specified by the server.
                  Therefore, the default <code>DirectoryIndex</code> document has a <code>.xml</code> extension.
                  See <link xlink:type="simple" xlink:href="/internet/domains/dotmobi.xml#issues">.mobi sites in Internet Explorer</link>
                  for more information on the issues with displaying the default <code>DirectoryIndex</code> document in IE.
               </p>
            </subpage>
            <updated local="2007-03-25">Sunday March 25, 2007</updated>
         </page>
      </pages>
   </section>
   <copyright>Copyright © 2007 How To Guides .com. Alteration of content, including addition of any function such as hypertext links or pop-up advertising, or interference with the hypertext links or other functions of this site is expressly prohibited.</copyright>
   <disclaimer>All information, links, forms, applications and other items on this site or obtained from it are provided <b>AS IS</b>, WITHOUT WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</disclaimer>
   <ids urchin="UA-779578-2"/>
</document>

