Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 8328 invoked from network); 29 Jun 2004 15:41:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Jun 2004 15:41:25 -0000 Received: (qmail 5140 invoked by uid 500); 29 Jun 2004 15:41:28 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 4987 invoked by uid 500); 29 Jun 2004 15:41:25 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 4948 invoked by uid 99); 29 Jun 2004 15:41:24 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [194.217.242.86] (HELO anchor-post-37.mail.demon.net) (194.217.242.86) by apache.org (qpsmtpd/0.27.1) with ESMTP; Tue, 29 Jun 2004 08:41:24 -0700 Received: from colina.demon.co.uk ([80.177.30.27]) by anchor-post-37.mail.demon.net with esmtp (Exim 3.35 #1) id 1BfKjQ-000AV4-0b for dev@cocoon.apache.org; Tue, 29 Jun 2004 16:41:12 +0100 Received: from colina.demon.co.uk (localhost.localdomain [127.0.0.1]) by colina.demon.co.uk (8.12.11/8.12.11) with ESMTP id i5TFdKvV003834 for ; Tue, 29 Jun 2004 16:39:20 +0100 Received: (from colin@localhost) by colina.demon.co.uk (8.12.11/8.12.11/Submit) id i5TFdKw5003829; Tue, 29 Jun 2004 16:39:20 +0100 To: dev@cocoon.apache.org Subject: CForms stylesheets - use of xsl:param and xhtml From: Colin Paul Adams Date: 29 Jun 2004 16:39:20 +0100 Message-ID: Lines: 65 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N The stylesheets in $COCOON_ROOT/src/blocks/samples/resources only handle html input/output. I use xhtml exclusively. Whilst I can easily copy the stylesheets to a private directory, and change them to work with xhtml instead, I would then have to re-work them every time changes were made to the distrbuted versions. Also other people would not benefit. So I thought it would be pretty easy to change the stylesheets so they could cope with either html or xhtml input (generating output as html for html input and xhtml as xhtml output). In principle, it IS easy, but I have come across two problems. The first is how to indicate to the stylsheets which format to use. No problem - just provide a global boolean xsl:param in the driver stylesheet (forms-samples-styling.xsl), defaulting to false, which can be set in the sitemap to true, if you want XHTML. The only problem with this is that is people have created their own driver stylesheet, then it will lack the parameter, and the stylesheets won't compile. But I guess as CForms is not yet stable, this could be acceptable. Then there is a related problem - basically a bug in the current stylesheets (but it may be intentional, if their is instead a bug in Xalan-J - I don't know - I'm guessing). The problem is that according to the XSLT specification (both 1.0 and 2.0), it is an error to have two global parameters with the same name in a stylesheet with the same import precedence, unless there is one with a higher import precedence. Now, in forms-advanced-field-styling.xsl, there is a global parameter named resources-uri. This module xsl:includes forms-calendar-styling.xsl and forms-htmlarea-styling.xsl both of which re-declare (identically) the same global parameter. As they are included rather than imported, they all have the same import precedence. A possible fix is to include rather than import these two modules - but maybe there is a good reason why this can't be done (I haven't looked at them closely enough to determine if include is necessary). A simpler fix is to remove the declarations from the included stylesheets - both of them state that they are designed to be included from forms-advanced-field-styling.xsl, so the global param is guarenteed to be present. My only worry about this is that there might be some bug in Xalan-C that has caused them to be written like this. presumably there is already a bug in this area with Xalan-C as the spec indicates that the current stylesheets are in error, and so should be rejected. Saxon 8 rejects them. Interestingly, xsltproc does not reject them. So after all that, if I were to provide patches that: a) Remove the offending global parameter from the two stylesheets, b) add a global parameter to the driver stylesheet c) Add code to all the stylesheets to read either html or xhtml input, and write output as html or xhtml according to the value of the new parameter would these pathces be accepted? (If not, then I don't want to bother, as it is then easier for me to do a copy-paste-edit cycle) -- Colin Paul Adams Preston Lancashire