xsl-list
[Top] [All Lists]

RE: [xsl] layout problem

2011-12-08 05:22:45

Oke, 

 

What Im trying to do is to make this layout (http://www.notepadchaos.com) in 
xml and xslt.

 

What I have so far is this : 

 

home.xsl :

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

 

<xsl:import href="../utilities/master.xsl"/>
<xsl:import href="../utilities/sections.xsl"/>

 

<xsl:template match="data">
 <xsl:call-template name="section-content"/>
</xsl:template>

</xsl:stylesheet>

 

master.xsl : 

 

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

 

<xsl:import href="../utilities/common.xsl"/>
<xsl:import href="../utilities/sections.xsl"/>

 

<xsl:output
 method="xml" 
 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" 
 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
 omit-xml-declaration="yes"
 encoding="UTF-8" 
 indent="yes" />

<xsl:template match="/">
 <html>
               <body>
  <xsl:call-template name="head"/>
  <xsl:apply-templates />
  <xsl:call-template name="bottom"/>
  </body>
 </html>  
</xsl:template>

</xsl:stylesheet>

 

 

sections.xsl : 

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template name="section-content">  
       <div id="outer">
          <div id="container">
                  <div id="search">
                    <form method="get" id="searchform" 
action="http:/test.tamarawobben.nl/">
                       <input type="text" value="" name="s" id="s" 
class="txtField" />
                      <input type="submit" id="searchsubmit" class="btnSearch" 
value="Find It ;" />
                  </form>
                </div>
                <div id="title">
                   <h2>Tamara Wobben </h2>
               </div>
               <div id="content">
                    <div class="col01">
  
             <xsl:for-each select="section/entry">
  <div class="post">
   <h2><xsl:value-of select="title"/></h2>
                      <div class="post-inner">
         <h4><xsl:value-of select="heading"/></h4>
       <xsl:copy-of select="description/*"/>
       <xsl:copy-of select="body/*"/>
                      </div>
             </div>
   </xsl:for-each>
       </div>
       </div>
      </div>
</div>
</xsl:template>

</xsl:stylesheet>

 

 

common.xsl : 

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template name="head">
       <head>
  <title><xsl:value-of select="$website-name"/> - <xsl:value-of 
select="$page-title"/></title>
  <link rel="stylesheet" type="text/css" 
href="{$workspace}/assets/css/style.css"/>
  <link rel="alternate" type="application/rss+xml" title="Notepad Chaos RSS 
Feed" href="http://www.notepadchaos.com/feed/"; />
<link rel="pingback" href="http://www.notepadchaos.com/xmlrpc.php"; />

<link rel="alternate" type="application/rss+xml" title="Notepad Chaos Feed" 
href="http://www.notepadchaos.com/feed/"; />
<link rel="alternate" type="application/rss+xml" title="Notepad Chaos Comments 
Feed" href="http://www.notepadchaos.com/comments/feed/"; />
<link rel="EditURI" type="application/rsd+xml" title="RSD" 
href="http://www.notepadchaos.com/xmlrpc.php?rsd"; />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" 
href="http://www.notepadchaos.com/wp-includes/wlwmanifest.xml"; /> 
<link rel='index' title='Notepad Chaos' href='http://www.notepadchaos.com/' />
 </head>
</xsl:template>

<xsl:template name="bottom">
 <div id="footer-holder">
  <div class="footer"> 
        <a href="http://www.notepadchaos.com/";>Notepad Chaos</a><br />
        <a href="http://www.notepadchaos.com/";>Notepad Chaos</a> uses the <a 
href="http://www.notepadchaos.com";>"Notepad Chaos v2"</a> theme.
   </div>
  <span class="evaneckard">
         <a href="http://www.evaneckard.com";>Evan Eckard Design</a>
   </span> 
   <span class="smashing">
      <a href="http://www.smashingmagazine.com";>Smashing Magazine</a>
   </span> 
   <span class="rss">
       <a href="http://www.notepadchaos.com/feed/";>RSS</a>
   </span>
</div>
</xsl:template>

</xsl:stylesheet>

 

I use this layout ( https://github.com/bauhouse/sym-bauhouse/tree/master/pages) 
as a example.

 

But if there a better way I will take that.

 

Roelof

 

 



----------------------------------------
Date: Thu, 8 Dec 2011 10:52:21 +0000
From: andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] layout problem

On 8 December 2011 10:34, Roelof Wobben <rwobben(_at_)hotmail(_dot_)com> 
wrote:

Hello,

I have this xml :

Why don't I get to see the output as I expected on the screen ?

Someone might put in the effort for you, but you really need to
re-post a 'small complete runnable example', containing only what's
necessary to demonstrate your problem. You don't have a root matching
template, and only one named template, so it needs an initial template
setting - as you didnt mention it its hard to know if thats
intentional.

Also, remember the helpful guide when you are new to xslt - avoid
named templates and avoid for-each, use the apply-templates and many
small templates.

--
Andrew Welch
http://andrewjwelch.com

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
                                        
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>