svn commit: r39220 - projects/sgml2xml/share/sgml

Gabor Kovesdan gabor at FreeBSD.org
Mon Jul 16 09:04:26 UTC 2012


Author: gabor
Date: Mon Jul 16 09:04:26 2012
New Revision: 39220
URL: http://svn.freebsd.org/changeset/doc/39220

Log:
  - Extend xhtml.xsl instead of duplicating common structural parts
  
  Approved by:	doceng (implicit)

Modified:
  projects/sgml2xml/share/sgml/templates.entries.xsl
  projects/sgml2xml/share/sgml/templates.events.xsl
  projects/sgml2xml/share/sgml/templates.newsflash.xsl
  projects/sgml2xml/share/sgml/templates.oldnewsflash.xsl
  projects/sgml2xml/share/sgml/templates.oldpress.xsl
  projects/sgml2xml/share/sgml/templates.pastevents.xsl
  projects/sgml2xml/share/sgml/templates.press.xsl
  projects/sgml2xml/share/sgml/templates.usergroups.xsl

Modified: projects/sgml2xml/share/sgml/templates.entries.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.entries.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.entries.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -12,9 +12,7 @@
   xmlns:cvs="http://www.FreeBSD.org/XML/CVS"
   exclude-result-prefixes="cvs">
 
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:param name="basename" select="'none'" />
   <xsl:param name="sort" select="'none'" />
@@ -22,19 +20,7 @@
   <xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
   <xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'"/>
 
-  <xsl:output method="xml" encoding="&xml.encoding;"
-    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
-
-  <xsl:template match="/entries">
-    <html>
-      &header1;
-      <body>
-	<div id="containerwrap">
-	  <div id="container">
-	    &header2;
-
-	    <div id="content">
+  <xsl:template name="process.content">
               <div id="SIDEWRAP">
                 &nav;
               </div> <!-- SIDEWRAP -->
@@ -42,25 +28,15 @@
 	      <div id="contentwrap">
 		&header3;
 
+		<xsl:for-each select="/entries">
 		<xsl:call-template name="html-commercial-preface" />
 
 		<xsl:call-template name="html-commercial-listing" />
+		</xsl:for-each>
 
 	      </div> <!-- contentwrap -->
 
 	      <br class="clearboth" />
-
-	    </div> <!-- content -->
-
-            <div id="FOOTER">
-	      &copyright;<br />
-	      &date;
-            </div> <!-- FOOTER -->
-
-	  </div> <!-- container -->
-	</div> <!-- containerwrap -->
-      </body>
-    </html>
   </xsl:template>
 
   <xsl:template name="html-commercial-preface">

Modified: projects/sgml2xml/share/sgml/templates.events.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.events.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.events.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -44,14 +44,7 @@
   exclude-result-prefixes="cvs">
 
   <xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
-
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
-
-  <xsl:output method="xml" encoding="&xml.encoding;"
-    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:param name="startyear">2007</xsl:param>
   <xsl:param name="pastyears">2003 2004 2005 2006</xsl:param>
@@ -72,8 +65,7 @@
 
   <xsl:variable name="charturl" select="'http://chart.apis.google.com/chart?cht=t&amp;chs=400x200&amp;chtm=world&amp;chco=ffffff,ffbe38,600000&amp;chf=bg,s,4D89F9'" />
 
-  <!-- Template: events -->
-  <xsl:template match="events">
+  <xsl:template name="process.content">
   <xsl:variable name="chart-countries">
     <xsl:for-each select="event[
 	generate-id() =
@@ -95,16 +87,6 @@
 
   <xsl:variable name="imageurl"><xsl:value-of select="$charturl"/>&amp;chd=t:<xsl:value-of select="$chart-country-counts"/>&amp;chld=<xsl:value-of select="$chart-countries"/></xsl:variable>
 
-    <html>
-      &header1;
-
-      <body>
-
-	<div id="containerwrap">
-	  <div id="container">
-	  &header2;
-
-	    <div id="content">
               <div id="SIDEWRAP">
                 &nav;
                 <div id="FEEDLINKS">
@@ -131,6 +113,7 @@
 	    format-number($curdate.day, '00'))"/>
 	</xsl:comment>
 
+	<xsl:for-each select="/events">
 		<xsl:call-template name="html-events-list-preface" />
 
 		<xsl:call-template name="html-events-map">
@@ -138,8 +121,9 @@
 		</xsl:call-template>
 
 		<xsl:call-template name="html-events-list-upcoming-heading" />
+	</xsl:for-each>
 
-	<xsl:for-each select="event[generate-id() =
+	<xsl:for-each select="/events/event[generate-id() =
           generate-id(key('event-by-month',
 	    concat(startdate/year, format-number(startdate/month, '00')))[1])
 	  and ((number(enddate/year) &gt; number($curdate.year)) or
@@ -176,9 +160,11 @@
 	  </ul>
 	</xsl:for-each>
 
+	<xsl:for-each select="/events">
 		<xsl:call-template name="html-events-list-past-heading" />
+	</xsl:for-each>
 
-	<xsl:for-each select="event[generate-id() =
+	<xsl:for-each select="/events/event[generate-id() =
 	  generate-id(key('event-by-month', concat(startdate/year,
 	    format-number(startdate/month, '00')))[1])
 	  and ((number(enddate/year) &gt;= $startyear)) and
@@ -219,24 +205,16 @@
 	<p>Events from past years:</p>
 
         <ul id="events-past-years">
+	<xsl:for-each select="/events">
 	<xsl:call-template name="split-string">
           <xsl:with-param name="seperator" select="' '"/>
           <xsl:with-param name="text" select="$pastyears"/>
         </xsl:call-template>
+	</xsl:for-each>
         </ul>
 	      </div> <!-- contentwrap -->
 
 	      <br class="clearboth" />
-	    </div> <!-- content -->
-
-            <div id="FOOTER">
-               &copyright;<br />
-               &date;
-            </div> <!-- FOOTER -->
-	  </div> <!-- container -->
-	</div> <!-- containerwrap -->
-      </body>
-    </html>
   </xsl:template>
 
   <!-- Template: event -->

Modified: projects/sgml2xml/share/sgml/templates.newsflash.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.newsflash.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.newsflash.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -14,26 +14,12 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
   xmlns:cvs="http://www.FreeBSD.org/XML/CVS">
   <xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
-
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:param name="news.project.xml-master" select="'none'" />
   <xsl:param name="news.project.xml" select="'none'" />
 
-  <xsl:output type="html" encoding="&xml.encoding;"/>
-
-  <xsl:template match="news">
-    <html>
-      &header1;
-      <body>
-
-	<div id="CONTAINERWRAP">
-	  <div id="CONTAINER">
-	    &header2;
-
-	    <div id="CONTENT">
+  <xsl:template name="process.content">
               <div id="SIDEWRAP">
                 &nav;
                 <div id="FEEDLINKS">
@@ -55,6 +41,7 @@
 	      <div id="CONTENTWRAP">
 		&header3;
 
+		<xsl:for-each select="/news">
 		<xsl:call-template name="html-news-list-newsflash-preface" />
 
 		<xsl:call-template name="html-news-list-newsflash">
@@ -65,19 +52,9 @@
 		<xsl:call-template name="html-news-make-olditems-list" />
 
 		<xsl:call-template name="html-news-list-newsflash-homelink" />
+		</xsl:for-each>
 
 	      </div> <!-- CONTENTWRAP -->
 	      <br class="clearboth" />
-	    </div> <!-- CONTENT -->
-
-            <div id="FOOTER">
-               &copyright;<br />
-               &date;
-            </div> <!-- FOOTER -->
-        </div> <!-- CONTAINER -->
-   </div> <!-- CONTAINERWRAP -->
-
-      </body>
-    </html>
   </xsl:template>
 </xsl:stylesheet>

Modified: projects/sgml2xml/share/sgml/templates.oldnewsflash.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.oldnewsflash.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.oldnewsflash.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -12,33 +12,17 @@
   xmlns:cvs="http://www.FreeBSD.org/XML/CVS">
 
   <xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:variable name="year">
     <xsl:value-of select="descendant::year/name"/>
   </xsl:variable>
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
   
-  <xsl:output type="html" encoding="&xml.encoding;"/>
-
   <xsl:template match="p">
     <xsl:copy-of select="." />
   </xsl:template>
 
-  <xsl:template match="news">
-    <html>
-      
-      &header1;
-
-      <body>
-
-	<div id="CONTAINERWRAP">
-	<div id="CONTAINER">
-
-	  &header2;
-
-	<div id="CONTENT">
+  <xsl:template name="process.content">
 	<div id="SIDEWRAP">
 	  &nav;
 	</div> <!-- SIDEWRAP -->
@@ -82,20 +66,6 @@
 	<a href="&base;/news/news.html">News Home</a>
 	</div> <!-- CONTENTWRAP -->
 	<br class="clearboth" />
-
-	  </div> <!-- CONTENT -->
-
-            <div id="FOOTER">
-               &copyright;<br />
-               &date;
-
-            </div> <!-- FOOTER -->
-
-	</div> <!-- CONTAINER -->
-	</div> <!-- CONTAINERWRAP -->
-
-      </body>
-    </html>
   </xsl:template>
 
   <!-- Everything that follows are templates for the rest of the content -->

Modified: projects/sgml2xml/share/sgml/templates.oldpress.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.oldpress.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.oldpress.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -12,30 +12,13 @@
   xmlns:cvs="http://www.FreeBSD.org/XML/CVS">
 
   <xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:variable name="year">
     <xsl:value-of select="descendant::year/name"/>
   </xsl:variable>
 
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
-  
-  <xsl:output type="html" encoding="&xml.encoding;"/>
-
-  <xsl:template match="press">
-    <html>
-      
-      &header1;
-
-      <body>
-
-	<div id="CONTAINERWRAP">
-	<div id="CONTAINER">
-
-	  &header2;
-
-	<div id="CONTENT">
+  <xsl:template name="process.content">
 	<div id="SIDEWRAP">
 	  &nav;
 	</div> <!-- SIDEWRAP -->
@@ -63,19 +46,6 @@
 	<a href="&base;/news/news.html">News Home</a>
 	</div> <!-- CONTENTWRAP -->
 	<br class="clearboth" />
-
-	</div> <!-- CONTENT -->
-
-            <div id="FOOTER">
-               &copyright;<br />
-               &date;
-            </div> <!-- FOOTER -->
-
-	</div> <!-- CONTAINER -->
-	</div> <!-- CONTAINERWRAP -->
-
-      </body>
-    </html>
   </xsl:template>
 
   <!-- Everything that follows are templates for the rest of the content -->

Modified: projects/sgml2xml/share/sgml/templates.pastevents.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.pastevents.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.pastevents.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -44,14 +44,7 @@
   exclude-result-prefixes="cvs">
 
   <xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
-
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
-
-  <xsl:output method="xml" encoding="&xml.encoding;"
-    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:param name="pastyears">2003 2004 2005 2006</xsl:param>
 
@@ -71,8 +64,8 @@
 
   <xsl:variable name="charturl" select="'http://chart.apis.google.com/chart?cht=t&amp;chs=400x200&amp;chtm=world&amp;chco=ffffff,ffbe38,600000&amp;chf=bg,s,4D89F9'" />
 
-  <!-- Template: events -->
-  <xsl:template match="events">
+  <xsl:template name="process.content">
+
   <xsl:variable name="chart-countries">
     <xsl:for-each select="event[
 	generate-id() =
@@ -94,16 +87,6 @@
 
   <xsl:variable name="imageurl"><xsl:value-of select="$charturl"/>&amp;chd=t:<xsl:value-of select="$chart-country-counts"/>&amp;chld=<xsl:value-of select="$chart-countries"/></xsl:variable>
 
-    <html>
-      &header1;
-
-      <body>
-
-	<div id="containerwrap">
-	  <div id="container">
-	  &header2;
-
-	    <div id="content">
               <div id="SIDEWRAP">
                 &nav;
                 <div id="FEEDLINKS">
@@ -130,6 +113,7 @@
 	    format-number($curdate.day, '00'))"/>
 	</xsl:comment>
 
+	<xsl:for-each select="/events">
 		<xsl:call-template name="html-events-list-preface" />
 
 		<xsl:call-template name="html-events-map">
@@ -138,8 +122,9 @@
 
 <!-- with parameter $year here? -->
 		<xsl:call-template name="html-events-list-past-heading" />
+	</xsl:for-each>
 
-	<xsl:for-each select="event[generate-id() =
+	<xsl:for-each select="/events/event[generate-id() =
 	  generate-id(key('event-by-month', concat(startdate/year,
 	    format-number(startdate/month, '00')))[1])
 	  and ((number(enddate/year) = $year))]">
@@ -176,25 +161,17 @@
 	<p>Events from past years:</p>
 
         <ul id="events-past-years">
+	<xsl:for-each select="/events">
 	<xsl:call-template name="split-string">
           <xsl:with-param name="seperator" select="' '"/>
           <xsl:with-param name="text" select="$pastyears"/>
         </xsl:call-template>
+	</xsl:for-each>
         </ul>
 
 	      </div> <!-- contentwrap -->
 
 	      <br class="clearboth" />
-	    </div> <!-- content -->
-
-            <div id="FOOTER">
-               &copyright;<br />
-               &date;
-            </div> <!-- FOOTER -->
-	  </div> <!-- container -->
-	</div> <!-- containerwrap -->
-      </body>
-    </html>
   </xsl:template>
 
   <!-- Template: event -->

Modified: projects/sgml2xml/share/sgml/templates.press.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.press.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.press.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -15,27 +15,12 @@
   xmlns:cvs="http://www.FreeBSD.org/XML/CVS">
 
   <xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
-
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:param name="news.press.xml-master" select="'none'" />
   <xsl:param name="news.press.xml" select="'none'" />
 
-  <xsl:output type="html" encoding="&xml.encoding;"/>
-
-  <xsl:template match="press">
-    <html>
-      &header1;
-      <body>
-
-  <div id="CONTAINERWRAP">
-    <div id="CONTAINER">
-
-	&header2;
-
-	<div id="CONTENT">
+  <xsl:template name="process.content">
               <div id="SIDEWRAP">
                 &nav;
                 <div id="FEEDLINKS">
@@ -53,6 +38,7 @@
 
 	      &header3;
 
+		<xsl:for-each select="/press">
 		<xsl:call-template name="html-news-list-press-preface" />
 
 	<xsl:call-template name="html-news-list-press">
@@ -63,21 +49,9 @@
 		<xsl:call-template name="html-press-make-olditems-list" />
 
 		<xsl:call-template name="html-news-list-newsflash-homelink" />
+		</xsl:for-each>
 
 	  	</div> <!-- CONTENTWRAP -->
 		<br class="clearboth" />
-
-	</div> <!-- CONTENT -->
-
-            <div id="FOOTER">
-               &copyright;<br />
-               &date;
-            </div> <!-- FOOTER -->
-
-        </div> <!-- CONTAINER -->
-   </div> <!-- CONTAINERWRAP -->
-
-      </body>
-    </html>
   </xsl:template>
 </xsl:stylesheet>

Modified: projects/sgml2xml/share/sgml/templates.usergroups.xsl
==============================================================================
--- projects/sgml2xml/share/sgml/templates.usergroups.xsl	Mon Jul 16 09:03:32 2012	(r39219)
+++ projects/sgml2xml/share/sgml/templates.usergroups.xsl	Mon Jul 16 09:04:26 2012	(r39220)
@@ -12,30 +12,14 @@
   xmlns:cvs="http://www.FreeBSD.org/XML/CVS"
   exclude-result-prefixes="cvs">
   <xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
-
-  <xsl:output method="xml" encoding="&xml.encoding;"
-    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
-    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
-
-  <xsl:variable name="date">
-    <xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
-  </xsl:variable>
+  <xsl:import href="http://www.FreeBSD.org/XML/www/share/sgml/xhtml.xsl"/>
 
   <xsl:key name="usergroup-by-country" match="entry"
     use="../@code" />
 
   <xsl:variable name="charturl" select="'http://chart.apis.google.com/chart?cht=t&amp;chs=400x200&amp;chtm=world&amp;chco=ffffff,ffbe38,600000&amp;chf=bg,s,4D89F9'" />
 
-  <xsl:template match="/">
-    <html>
-      &header1;
-
-      <body>
-	<div id="CONTAINERWRAP">
-	  <div id="CONTAINER">
-	    &header2;
-
-	    <div id="CONTENT">
+  <xsl:template name="process.content">
 	      <div id="SIDEWRAP">
 		&nav;
 	      </div> <!-- SIDEWRAP -->
@@ -81,15 +65,5 @@
 	      </div> <!-- CONTENTWRAP -->
 
 	      <br class="clearboth" />
-	    </div> <!-- CONTENT -->
-
-	    <div id="FOOTER">
-	      &copyright;<br />
-	      &date;
-	    </div> <!-- FOOTER -->
-	  </div> <!-- CONTAINER -->
-	</div> <!-- CONTAINERWRAP -->
-      </body>
-    </html>
   </xsl:template>
 </xsl:stylesheet>


More information about the svn-doc-projects mailing list