[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: layout problem

Subject: RE: layout problem
From: Roelof Wobben <rwobben@xxxxxxxxxxx>
Date: Thu, 8 Dec 2011 11:22:31 +0000
RE:  layout problem
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.j.welch@xxxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  layout problem
>
> On 8 December 2011 10:34, Roelof Wobben <rwobben@xxxxxxxxxxx> 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.