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

Re: header/footer: How to to separate html-tag in to differe

Subject: Re: header/footer: How to to separate html-tag in to different xsl-template rules?
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 23 Jun 2000 11:55:26 -0600 (MDT)
html tags footer
> How could I separate headers and footers in my xsl-templates? My problem
> is, that I cannot have a tag like "body" in an <xsl:template>, whithout
> closing it.
> 
> So how to do:
> 
> <xsl:template match="header">
>   <html>
>   <head>
>   </head>
>   <body>
> </xsl:template>
> 
> <xsl:template match="footer">
>   </body>
>   </html>
>  </xsl:template>

XSLT does not operate on tags. It operates on a tree of nodes that is
implied by the markup. For example,

<html>
  <head>head stuff</head>
  <body>body stuff</body>
</html>

has a node tree like

root
 |___element 'html'
       |___text '\n  '
       |___element 'head'
       |     |___text 'head stuff'
       |___text '\n  '
       |___element 'body'
             |___text 'body stuff'

Furthermore, the markup you are putting in the stylesheet is not a
specification for literal output. It is a specification for how the XSLT
processor should go about creating another node tree, the 'result tree'.
Your HTML output will be *derived* from this result tree after it is
created. Not only that, but the XSLT itself is XML, and must be
well-formed.

So begin thinking in terms of complete elements:

<xsl:template match="doc">
  <html>
    <head>
      <xsl:apply-templates select="doc_head"/>
    </head>
    <body>
      <xsl:apply-templates select="content"/>
    </body>
  </html>
</xsl:template>

...just as an example.

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


 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.