Return-Path: Delivered-To: apmail-xml-forrest-dev-archive@www.apache.org Received: (qmail 94911 invoked from network); 7 Oct 2003 09:19:17 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 7 Oct 2003 09:19:17 -0000 Received: (qmail 30727 invoked by uid 500); 7 Oct 2003 09:18:50 -0000 Delivered-To: apmail-xml-forrest-dev-archive@xml.apache.org Received: (qmail 30692 invoked by uid 500); 7 Oct 2003 09:18:50 -0000 Mailing-List: contact forrest-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: forrest-dev@xml.apache.org Delivered-To: mailing list forrest-dev@xml.apache.org Received: (qmail 30681 invoked from network); 7 Oct 2003 09:18:50 -0000 Received: from unknown (HELO postfix3-1.free.fr) (213.228.0.44) by daedalus.apache.org with SMTP; 7 Oct 2003 09:18:50 -0000 Received: from lns-p19-7-82-65-224-91.adsl.proxad.net (lns-p19-7-82-65-224-91.adsl.proxad.net [82.65.224.91]) by postfix3-1.free.fr (Postfix) with ESMTP id 5C08FC4F98 for ; Tue, 7 Oct 2003 11:18:57 +0200 (CEST) From: Eric BURGHARD To: forrest-dev@xml.apache.org Subject: Re: [CONTRIB] auto generation of menus Date: Tue, 7 Oct 2003 02:59:54 +0200 User-Agent: KMail/1.5.3 References: <200310032312.04821.eburghar@free.fr> <20031006064742.GB2395@expresso.localdomain> In-Reply-To: <20031006064742.GB2395@expresso.localdomain> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_KAhg/oB9gKMqpI9" Message-Id: <200310070259.54950.eburghar@free.fr> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --Boundary-00=_KAhg/oB9gKMqpI9 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Lundi 06 Octobre 2003 08:47, Jeff Turner a =E9crit : > On Fri, Oct 03, 2003 at 11:12:04PM +0200, Eric BURGHARD wrote: > > Hi, > > > > I've made some modifications to directory2book.xsl (which generate side > > menu based on directory content): > > -little cleanup (expected-extension argument no more needed) > > -kind of control on which items are present or not > > -allow parametrable sorting of menu-items > > -easily extensible. > > Nice. I've committed it with some modifications: > > - Used the existing pathutils.xsl instead of substring-last.xsl > - I didn't understand the purpose of documentdirectory.xsl, so I put its > enhanced get-label template in directory2book.xml. Any reason to > separate it out, other than to demonstrate its 'overridability'? > ;-) Yeah, in fact, directory2book.xsl is not specificly designed to be used wit= h=20 XPathDirectoryGenerator. Right ? After a simple DirectoryGenerator you've g= ot=20 no dir:xpath nodeset in the result. So is there any good reason to compute= =20 the menu-items labels from inexistants tags and rely on the default behavio= r=20 which take them from the filenames ? On the other side, when you apply documentdirectory2book.xsl you say=20 indirectly your intention to scan directory full of document-v20 compliant= =20 xml. This stylesheet rely on XPathDirectoryGenerator because the get-label= =20 template make use of dir:xpath contents. If you've got docbook directories, perhaps you want to get the labels from= =20 something else than (the meta tag could possib= ly=20 not exists in docbook or exists in another branch than document/header, i=20 don't know). So just edit a new docbookdirectory2book.xsl which only need t= o=20 override the get-label with something like: and modify your sitemap.xmap accordingly In the last version of my directory2book.xsl (attached) I also define a=20 get-href named template. That way you can easily compute the urls served by= =20 menu-items. Example: for my simple gallery i use a jpegdirectory2book.xsl=20 which is quite simple and clear: for each of my jpegs i've got a menu-item item which link to something like= =20 img-1024.jpg which refer to img.jpg with a 1024 pixels height. Somewhere in my sitemap.xmap i've got this to generate jpeg at a given heig= ht. and by default (in directory2book.xsl) get-href is which link items with something like filename.html > Sorting by XPath is a good idea, but ordering still doesn't seem flexible > enough for ordinary sites. Perhaps we need another transformer that sets > a field based on some clever algorithm: > > > > > That would be nice. I didn't like the fact to use a non standard xslt=20 extension to achieve this sorting flexibility in my stylesheet, but it was = a=20 good preliminary that fullfill my needs. > Then pages could have some metadata used by the sorting algorithm: > > GettingStarted > > index.html > > primer.html > Yeah ! much more flexibility like this ! Thus you can already achieve quite= =20 the same behavior with the actual sorting mechanism and without the hassle = of=20 programming a constraints resolution engine. Use directory hierachie a=20 relaxed numbering scheme (like sysV init filenames): directory: GettingStarted file1 S5 index.xml S0 primer.xml S20 and do your sorting with PS: What did the pathutils.xsl do in resources/skins/common/xslt/html=20 directory ? Shouldn't it be placed in resources/stylesheets ? > > --Jeff --Boundary-00=_KAhg/oB9gKMqpI9 Content-Type: text/xml; charset="iso-8859-1"; name="directory2book.xsl" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="directory2book.xsl" --Boundary-00=_KAhg/oB9gKMqpI9--