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

RE: Can you have a dummy XSL?

Subject: RE: Can you have a dummy XSL?
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Thu, 02 Aug 2001 12:35:54 +0200
xml dummy html template
Hewko, Doug wrote:
> Can you have a XSL that does not do any text formatting or
> processing? I am working on a web page and want to enforce
> a standard look and feel. Part of  this standard is a generic
> header title, left bar navigation and footer information. Tables
> would be used to maintain this look and feel. The title,
> left bar and footer will contain text, links and icons. These would
> all be standard.

I really wonder that nobody proposed to use document():
   <xsl:tepmlate match="/">
     <html>
       <head><title>Stuff</title></head>
       <body>
         <table>
            <tr>
              <td>
               <xsl:copy-of select="document('std.xml')/*/left-bar-navigation">
              </td>
              <td>
                <xsl:apply-templates/>
              </td>
            </tr>
            <tr>
              </td>
                 <xsl:copy-of select="document('std.xml')/*/footer">
              </td>
            </tr>
         </table>
       </body>
     </html>
   </xsl:template>

You may have put the table for the general layout into the template
above. The "std.xml" should be something like
  <root>
    <left-bar-navigation>
      <table>
         <tr><th>Navigation</th></tr>
         <tr><td><a href="link">link</a></td></tr>
      </table>
    </left-bar-navigation>
    <footer>
       .....
    </footer
  </root>

An interesting alternative may be to use a sort of HTML-template:
File template.xml
     <html xmlns:t="your.uri/template">
       <head>
         <title>
           <t:title/>
         </title>
       </head>
       <body>
         <table>
            <tr>
              <td>
                <table>
                  <tr><th>Navigation</th></tr>
                  <tr><td><a href="link">link</a></td></tr>
                </table>
              </td>
              <td>
               <t:content/>
              </td>
            </tr>
            <tr>
              </td>
                 <!-- footer -->
              </td>
            </tr>
         </table>
       </body>
     </html>

File your.xsl
  <xsl:stylesheet
     xmlns:xsl="..."
     xmlns:t="your.uri/template">
     <!-- save input doc -->
     <xsl:variable name="doc" select="/"/>
     <xsl:template match="/">
       <xsl:apply-templates
          select="document('template.xml')"
          mode="template"/>
     </xsl:template>
     <!-- important: copy-through template elements -->
     <xsl:template match="*|@*|text()" mode="template">
        <xsl:copy>
          <xsl:apply-templates select="node()|@*"
             mode="template"/>
        </xsl:copy>
     </xsl:template>
     <!-- handle HTML title -->
     <xsl:template match="t:title" mode="template">
       <xsl:apply-templates select="$doc" mode="title"/>
     </xsl:template>
     <!-- handle HTML content -->
     <xsl:template match="t:title" mode="template">
       <xsl:apply-templates select="$doc" mode="content"/>
     </xsl:template>
     <!-- example: retrive title -->
     <xsl:template match="/" mode="title">
       <xsl:value-of select="/document/docinfo/title"/>
     </xsl:template>
     <!-- example: usual content handling -->
     <xsl:template match="/" mode="content">
       <xsl:apply-templates select="$doc"/>
     </xsl:template>
   <xsl:stylesheet>

(not tested)

HTH
J.Pietschmann
--

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


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.