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

RE: Streamline xslt

Subject: RE: Streamline xslt
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Wed, 25 Sep 2002 11:08:14 -0700
folder indexer
Hi,

Why not use xsl:include?

I like to keep all of my xsl:includes, variables and params in a global
definitions XSL. This is included in each primary/main XSLT. An example of a 2
column layout:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
basic_2col.xsl  - A basic 2 column layout
===========
This is a primary stylesheet. Each primary stylesheet includes
global_definitions.xsl,
which in turn includes the common XSL pages. Much of the layout can be affected
just
by changing the /css/project.css. When a page is requested/generated, a source
XML
(always /WEB-INF/styling/site.xml) is transformed against a primary XSL -->
  <!-- *********** GLOBAL DEFINITIONS ************ -->
  <!-- global_definitions.xsl includes the common XSL templates, gathers
parameters sent in
from  the server and sets up common global variables. -->
  <xsl:include href="global_definitions.xsl"/>
  <xsl:variable name="root_relative" select="'false'"/>
  <!-- match the document root to start setting up the HTML page structure -->
  <xsl:template match="/">
    <html>
      <!-- *********** HTML HEAD ************ -->
      <!-- call to head.xsl to set up the HTML HEAD -->
      <xsl:call-template name="head"/>
      <body onload="{$body_onload_call}">
        <!-- *********** BANNER (top of the page) ************ -->
        <!-- call to banner.xsl to set up the top part of the page -->
        <xsl:call-template name="banner"/>
        <!-- *********** START MAIN LEFT COLUMN ************ -->
        <!-- ======================================= -->
        <div id="leftcol">
          <!-- ======== NAVIGATION? ======== -->
          <!-- if the /WEB-INF/styling/site.xml has it's /config/@nav_col set
to... -->
          <xsl:if test="$nav_col='narrow_left' or $nav_col='tabs_narrow_left'">
             <xsl:call-template name="nav"/>
          </xsl:if>
          <!-- ======== LEFT COLUMN CONTENT ======== -->
          <!-- applying templates on the folder's center column content and then
the
              page's center column content. The match happens in find_xml.xsl.
Normally,
              find_xml.xsl does not need to be altered. After the XML file is
found it proceeds
              to the article.xsl template which you might want to alter.-->
          <div class="floater">
            <xsl:apply-templates
select="$folder_nodeset/col[@type='narrow_left']" mode="main_content"/>
            <xsl:apply-templates select="$page_nodeset/col[@type='narrow_left']"
mode="main_content"/>
          </div>
          <br clear="all"/>
        </div>
        <!-- ======================================= -->
        <!-- *********** END MAIN RIGHT COLUMN ************ -->
        <!-- *********** START MAIN CENTER COLUMN ************ -->
        <!-- ======================================= -->
        <div id="centercol2left">
          <!-- ======== SNAIL TRAIL ? ======== -->
          <!-- Does the current page's folder properties indicate there should
be a snailtrail? -->
          <xsl:if test="$folder_nodeset/@snailtrail='true'">
            <xsl:call-template name="snailtrail"/>
          </xsl:if>
          <!-- ======== PAGER TOP ? ======== -->
          <!-- Does the current page's folder properties indicate there should
be
              a pager (i.e ' prev 1 2 3 n next ') above the content? -->
          <xsl:if test="$folder_nodeset/@pager='true'">
            <br clear="all"/>
            <xsl:call-template name="pager"/>
          </xsl:if>
          <!-- ======== PRINT FRIENDLY ======== -->
          <!-- Does the current page's properties indicate there should be a
print friendly link
              showing on the page? -->
          <xsl:if test="$page_nodeset/@print_friendly='true'">
            <br clear="all"/>
            <xsl:call-template name="pf_link"/>
          </xsl:if>
          <!-- ======== NAVIGATION? ======== -->
          <!-- if the /WEB-INF/styling/site.xml has it's /config/@nav_col set
to...  -->
      	<xsl:if test="$nav_col='wide_center'">
      		<xsl:call-template name="nav"/>
      	</xsl:if>
          <!-- ======== CENTER COLUMN CONTENT TABLE OF CONTENTS? ======== -->
          <!-- Does the current page's properties indicate there should be a
table of contents? -->
          <xsl:if test="$page_nodeset/@toc='true'">
            <xsl:call-template name="toc"/>
          </xsl:if>
          <!-- ======== CENTER COLUMN CONTENT ======== -->
          <!-- applying templates on the folder's center column content and then
              the page's center column content. The match happens in
find_xml.xsl.
              Normally, find_xml.xsl does not need to be altered. After the XML
file is
              found it proceeds to templates which you might want to alter -->
          <xsl:apply-templates select="$folder_nodeset/col[@type='wide_center']"
mode="main_content"/>
          <xsl:apply-templates select="$page_nodeset/col[@type='wide_center']"
mode="main_content"/>
          <!-- ======== FOLDER INDEXER ======== -->
          <!-- Does the current page's folder properties indicate there should
be a
              pager (i.e ' prev 1 2 3 n next ') below the content? [same as
above] -->
          <xsl:if test="$folder_nodeset/@index='true'">
            <xsl:call-template name="indexer"/>
          </xsl:if>
          <!-- ======== PAGER BOTTOM ? ======== -->
          <!-- Does the current page's folder properties indicate there should
be a
              pager (i.e ' prev 1 2 3 n next ') below the content? [same as
above] -->
          <xsl:if test="$folder_nodeset/@pager='true'">
            <br clear="all"/>
            <xsl:call-template name="pager"/>
          </xsl:if>
          <!-- ======== CENTER COLUMN CONTENT METADATA? ======== -->
        <!-- Does the current page's properties indicate there should be a
metadata
                  showing on the page? -->
        <xsl:if test="$page_nodeset/@metadata='true'">
          <xsl:call-template name="metadata"/>
        </xsl:if>
          <br clear="all"/>
        </div>
        <!-- ======================================= -->
        <!-- *********** END MAIN CENTER COLUMN ************ -->
        <br clear="all"/>
        <xsl:call-template name="footer"/>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>






> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Geoff
> Sent: Wednesday, September 25, 2002 10:26 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Streamline xslt
>
>
> I love using XSLT because I can expose my web pages as xml and use xslt
> to transform the xml into html or something else like wml. The
> presentation is cleanly separated from content.
>
> The problem I see is if I need to change the presentation. I'm sure
> someday at some point someone will say let's give the Website a new
> look. Each "page" has a php script that either points to an xml file or
> creates xml on the fly, then points to an xsl file and passes this to
> the Sablotron processor. To change the site design I have to update each
> xsl file in the site.The html is the same for each xsl stylesheet except
> the part where the xsl code lives.So ideally I would divide the file
> into header.inc, the xsl part and footer.inc.
>
> The first thought I had was use includes. Php includes won't work
> because the first thing the Sablotron processor sees is <?php //php code
> ?>. I assume the same problem occurs with Apache includes.
> XSL includes must be well formed xml documents so that wouldn't work
> either.
>
> Any suggestions?
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Streamline xslt
    • Geoff - Wed, 25 Sep 2002 13:26:27 -0400 (EDT)
      • Walter Torres - Wed, 25 Sep 2002 13:38:49 -0400 (EDT)
      • Mike Brown - Wed, 25 Sep 2002 13:51:58 -0400 (EDT)
      • Robert Koberg - Wed, 25 Sep 2002 14:07:54 -0400 (EDT) <=
        • Geoff - Thu, 26 Sep 2002 08:14:47 -0400 (EDT)
      • Wendell Piez - Wed, 25 Sep 2002 14:12:00 -0400 (EDT)
      • Michael Kay - Wed, 25 Sep 2002 14:21:48 -0400 (EDT)

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.