joerg 2004/01/22 10:02:38
Modified: src/blocks/woody/samples/resources woody-page-styling.xsl
woody-field-styling.xsl woody-calendar-styling.xsl
woody-advanced-field-styling.xsl
woody-samples-styling.xsl
Log:
Changed the relations of the stylesheets to each other (see the comments in
them for more details). This is an important change as it can possibly break
some other's stylesheet imports/includes.
Revision Changes Path
1.17 +9 -3
cocoon-2.1/src/blocks/woody/samples/resources/woody-page-styling.xsl
Index: woody-page-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-page-styling.xsl,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- woody-page-styling.xsl 22 Jan 2004 16:04:15 -0000 1.16
+++ woody-page-styling.xsl 22 Jan 2004 18:02:38 -0000 1.17
@@ -5,11 +5,17 @@
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
exclude-result-prefixes="wi">
- <xsl:template name="woody-page-head">
- <!-- only woody_showTab is needed here. Assume woody-lib.js is loaded by
the field-styling -->
+ <!--+
+ | This stylesheet is designed to be included by
'woody-samples-styling.xsl'.
+ +-->
+ <xsl:template match="head" mode="woody-page">
+ <!--+ 'woody-page-styling.xsl' relies on 'woody-field-styling.xsl' for
the
+ | inclusion of the correct JS and CSS files. To fix it, we have to
+ | separate the page specific parts into its own files.
+ +-->
</xsl:template>
- <xsl:template name="woody-page-body"/>
+ <xsl:template match="body" mode="woody-page"/>
<!--
wi:group : default is to enclose items in a div
1.34 +8 -15
cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl
Index: woody-field-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- woody-field-styling.xsl 22 Jan 2004 16:03:17 -0000 1.33
+++ woody-field-styling.xsl 22 Jan 2004 18:02:38 -0000 1.34
@@ -4,30 +4,23 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
exclude-result-prefixes="wi">
-
+
<!--+
- | This stylesheet is designed to be imported by
'woody-samples-styling.xsl'.
- | Uncomment this variable declaration if you need to use it by itself.
- |
- | <xsl:param name="resources-uri">resources</xsl:param>
+ | This stylesheet is designed to be included by
'woody-samples-styling.xsl'.
+-->
- <!-- must be called in <head> -->
- <xsl:template name="woody-field-head">
+ <!-- Location of the resources directory, where JS libs and icons are
stored -->
+ <xsl:param name="resources-uri">resources</xsl:param>
+
+ <xsl:template match="head" mode="woody-field">
<script src="{$resources-uri}/mattkruse-lib/AnchorPosition.js"
language="JavaScript" type="text/javascript"/>
<script src="{$resources-uri}/mattkruse-lib/PopupWindow.js"
language="JavaScript" type="text/javascript"/>
<script src="{$resources-uri}/woody-lib.js" language="JavaScript"
type="text/javascript"/>
+ <link rel="stylesheet" type="text/css"
href="{$resources-uri}/woody.css"/>
</xsl:template>
- <!--+
- | must be called in <body>
- +-->
- <xsl:template name="woody-field-body">
+ <xsl:template match="body" mode="woody-field">
<xsl:attribute name="onload">woody_onload(); <xsl:value-of
select="@onload"/></xsl:attribute>
- <!--script language="JavaScript">
- // Register woody startup function
- document.body.onload = woody_init;
- </script-->
</xsl:template>
<!--+
1.7 +7 -17
cocoon-2.1/src/blocks/woody/samples/resources/woody-calendar-styling.xsl
Index: woody-calendar-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-calendar-styling.xsl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- woody-calendar-styling.xsl 22 Jan 2004 15:59:21 -0000 1.6
+++ woody-calendar-styling.xsl 22 Jan 2004 18:02:38 -0000 1.7
@@ -4,24 +4,17 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
exclude-result-prefixes="wi">
-
+
<!--+
- | This stylesheet is designed to be imported by
'woody-samples-styling.xsl'.
- | Uncomment this variable declaration if you need to use it by itself.
- |
- | <xsl:param name="resources-uri">resources</xsl:param>
+ | This stylesheet is designed to be included by
'woody-advanced-styling.xsl'.
+-->
- <!-- must be called in <head> to load calendar script and setup the CSS -->
- <xsl:template name="woody-calendar-head">
- <!-- assume these have been loaded by woody-field-styling
- <script src="{$resources-uri}/mattkruse-lib/PopupWindow.js"
language="JavaScript" type="text/javascript"/>
- <script src="{$resources-uri}/mattkruse-lib/AnchorPosition.js"
language="JavaScript" type="text/javascript"/>
- -->
+ <!-- Location of the resources directory, where JS libs and icons are
stored -->
+ <xsl:param name="resources-uri">resources</xsl:param>
+
+ <xsl:template match="head" mode="woody-calendar">
<script src="{$resources-uri}/mattkruse-lib/CalendarPopup.js"
language="JavaScript" type="text/javascript"/>
<script src="{$resources-uri}/mattkruse-lib/date.js"
language="JavaScript" type="text/javascript"/>
-
-
<script language="JavaScript" type="text/javascript">
// Setup calendar
var woody_calendar = CalendarPopup('woody_calendarDiv');
@@ -30,16 +23,13 @@
woody_calendar.showYearNavigationInput();
woody_calendar.setCssPrefix("woody_");
</script>
- </xsl:template>
-
- <xsl:template name="woody-calendar-css">
<link rel="stylesheet" type="text/css"
href="{$resources-uri}/woody-calendar.css"/>
</xsl:template>
<!--+
| must be called in <body>
+-->
- <xsl:template name="woody-calendar-body">
+ <xsl:template match="body" mode="woody-calendar">
<div id="woody_calendarDiv"/>
</xsl:template>
1.5 +24 -14
cocoon-2.1/src/blocks/woody/samples/resources/woody-advanced-field-styling.xsl
Index: woody-advanced-field-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-advanced-field-styling.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- woody-advanced-field-styling.xsl 22 Jan 2004 15:34:01 -0000 1.4
+++ woody-advanced-field-styling.xsl 22 Jan 2004 18:02:38 -0000 1.5
@@ -6,28 +6,38 @@
exclude-result-prefixes="wi">
<!--+
- | This stylesheet is designed to be imported by
'woody-samples-styling.xsl'.
- | Uncomment this variable declaration if you need to use it by itself.
- |
- | <xsl:param name="resources-uri">resources</xsl:param>
+ | This stylesheet is designed to be included by
'woody-samples-styling.xsl'.
+ | It extends the 'woody-field-styling.xsl' with additional stylings.
+ | The calendar can also be seen as advanced field styling, it's only
+ | separated out of this file because of its much specific stuff.
+-->
- <!--+
- | must be called in <head>
- +-->
- <xsl:template name="woody-advanced-field-head">
+ <xsl:import href="woody-field-styling.xsl"/>
+ <xsl:include href="woody-calendar-styling.xsl"/>
+ <!-- Location of the resources directory, where JS libs and icons are
stored -->
+ <xsl:param name="resources-uri">resources</xsl:param>
+
+ <xsl:template match="head" mode="woody-field">
+ <xsl:apply-imports/>
<script src="{$resources-uri}/mattkruse-lib/OptionTransfer.js"
language="JavaScript" type="text/javascript"/>
<script src="{$resources-uri}/mattkruse-lib/selectbox.js"
language="JavaScript" type="text/javascript"/>
+ <xsl:apply-templates select="." mode="woody-calendar"/>
</xsl:template>
- <!--+
- | must be called in <body> to load help popups, calendar script,
- | and setup the CSS
- +-->
- <xsl:template name="woody-advanced-field-body">
- <!-- nothing here for now -->
+ <xsl:template match="body" mode="woody-field">
+ <xsl:apply-imports/>
+ <xsl:apply-templates select="." mode="woody-calendar"/>
</xsl:template>
+ <!--+ This template should not be necessary as this stylesheet "inherits"
+ | all templates from 'woody-field-styling.xsl', but without it, it does
+ | not work for me (using Xalan 2.5.1). It's like adding all methods of
+ | a superclass in a subclass and calling everywhere only the super
+ | implementation.
+ +-->
+ <xsl:template match="*">
+ <xsl:apply-imports/>
+ </xsl:template>
<!--+
| wi:multivaluefield with list-type='double-listbox' styling
1.6 +16 -31
cocoon-2.1/src/blocks/woody/samples/resources/woody-samples-styling.xsl
Index: woody-samples-styling.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-samples-styling.xsl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- woody-samples-styling.xsl 10 Dec 2003 12:23:11 -0000 1.5
+++ woody-samples-styling.xsl 22 Jan 2004 18:02:38 -0000 1.6
@@ -1,44 +1,29 @@
<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <!-- Location of the resources directory, where JS libs and icons are
stored -->
- <xsl:param name="resources-uri">resources</xsl:param>
-
- <!-- Include styling stylesheets -->
- <!-- FIXME: xalan silently ignores non-existing stylesheets (such as when
there's a typo in the name)
- ==> Is it in the XSLT spec? -->
- <xsl:include href="woody-field-styling.xsl"/>
+ <!--+ Include styling stylesheets, one for the widgets, the other one for
the
+ | page. As 'woody-advanced-field-styling.xsl' is a specialization of
+ | 'woody-field-styling.xsl' the latter one is imported there. If you
don't
+ | want advanced styling of widgets, change it here!
+ | See xsl:include as composition and xsl:import as
extension/inheritance.
+ +-->
<xsl:include href="woody-page-styling.xsl"/>
- <xsl:include href="woody-calendar-styling.xsl"/>
<xsl:include href="woody-advanced-field-styling.xsl"/>
<xsl:template match="head">
- <xsl:copy>
+ <head>
<xsl:apply-templates/>
- <!-- insert the head snippets required by the styling stylesheets -->
- <xsl:call-template name="woody-field-head"/>
- <xsl:call-template name="woody-page-head"/>
- <xsl:call-template name="woody-calendar-head"/>
- <xsl:call-template name="woody-advanced-field-head"/>
-
- <link rel="stylesheet" type="text/css"
href="{$resources-uri}/woody.css"/>
-
- <xsl:call-template name="woody-calendar-css"/>
- </xsl:copy>
+ <xsl:apply-templates select="." mode="woody-page"/>
+ <xsl:apply-templates select="." mode="woody-field"/>
+ </head>
</xsl:template>
<xsl:template match="body">
- <xsl:copy>
- <!--xsl:copy-of select="@*"/-->
-
- <!-- insert the body snippets required by the styling stylesheets -->
- <xsl:call-template name="woody-field-body"/>
- <xsl:call-template name="woody-page-body"/>
- <xsl:call-template name="woody-calendar-body"/>
- <xsl:call-template name="woody-advanced-field-body"/>
+ <body>
<xsl:apply-templates/>
- </xsl:copy>
+ <xsl:apply-templates select="." mode="woody-page"/>
+ <xsl:apply-templates select="." mode="woody-field"/>
+ </body>
</xsl:template>
+
</xsl:stylesheet>