Re: [xsl] Advise on xsl usage producing very complex html

Subject: Re: [xsl] Advise on xsl usage producing very complex html
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 1 Feb 2001 09:48:15 GMT
> the question is:

Ah. Ok well in that case I think I'd go with Mike Kay's suggestion.
Specifically if you can arrange that each of your large chunks is a well
formed XML fragment with as many </xxx> as <xxx> you can stick them in
separate documents such as

big-chunk-of table-head.xml

big-chunk-of-table-foot.xml

big-chunk-of-html-head.xml

Then your stylesheet looks something like this

<xsl:stylesheet....>

<xsl:variable name="html-head" 
              select="document('big-chunk-of-html-head.xml')"/>
<xsl:variable name="table-head" 
              select="document('big-chunk-of-table-head.xml')"/>
<xsl:variable name="table-foot" 
              select="document('big-chunk-of-table-foot.xml')"/>


<xsl:template match="/">
<html>
 <!-- the <head> eleemnt pulled in from file --> 
 <xsl:copy-of select="$html-head"/>
 <body>
  <xsl:templates/>
 </body>
</html> <!-- the <head> eleemnt pulled in from file --> 
 <xsl:copy-of select="$html-head"/>

</xsl:template>

<xsl:template match="input-table-element">
 <table>
 <!-- the <thead> eleemnt pulled in from file --> 
 <xsl:copy-of select="$table-head"/>
 <!-- the <tfoot> eleemnt pulled in from file --> 
 <xsl:copy-of select="$table-foot"/>
 <tbody>
   <xsl:templates/>
 </tbody>
 </table>
</xsl:template>

</xsl:stylesheet>

Note thatthis way whoever is writing the "templates" for the
table head and foot need only write (X)HTML code, and not any XSL syntax
at all.

David

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


Current Thread