RE: [xsl] layout problem

Subject: RE: [xsl] layout problem
From: Roelof Wobben <rwobben@xxxxxxxxxxx>
Date: Thu, 8 Dec 2011 12:21:03 +0000
----------------------------------------
> Date: Thu, 8 Dec 2011 11:36:14 +0000
> From: andrew.j.welch@xxxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] layout problem
>
> It's not clear what question you are asking...
>
> Looking at your code you can make some improvments:
>
> > <xsl:template match="data">
> > <xsl:call-template name="section-content"/>
> > </xsl:template>
>
> Don't do that ^^^^, just move the contents of the named template
> 'section-content' into the body of the template.
>



So it will be this :



<xsl:template match ="data">

   <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>




> > <body>
> > <xsl:call-template name="head"/>
> > <xsl:apply-templates />
> > <xsl:call-template name="bottom"/>
> > </body>
>
> Instead of the call-template you should use apply-templates and modes.
> If you really do have to use named templates, pass the context
> explicitly as a parameter. The reason is it helps whoever maintains
> the code down the line.





oke, That will be then this :



<body>

   <xsl:apply-templates mode="head">

   <xsl:apply-templates>

   <xsl:apply-templates mode="bottom"

</body>






>
> > <xsl:template name="section-content">
>
> change that to a match



that one would be deleted because it's merged with the template match="data"






>
> > <xsl:for-each select="section/entry">
>
> change that to apply-templates



So that would be :





<xsl: apply-templates match="section/entry">






>
>
> > <xsl:template name="head">
>
> > <xsl:template name="bottom">
>
> change those to matches with a mode





The last one would be :



<xsl: template mode="head">

<xsl: template mode="bottom">

Current Thread