[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: counter in XSL - some more info ... help still nee
At 2003-12-04 13:21 +0100, Sebastian Fey wrote:
the documentation consists of several docbook-xml-documents, each document is part of a class. Who says you cannot use xsl:number? This is what it is there for. It looks like you want to count those books whose referenced book type is either 'classB' or 'classAll'. If I've understood your needs correctly, then just count the things you need by describing the nodes that need to be counted (let the XSLT processor do the heavy lifting): <xsl:number count="book[document(@fileref)/book/@type='classB' or document(@fileref)/book/@type='classALL']"/> I need sth like a counter to solve this problem ... If you really want to use a counter then you'll have to use another environment because XSLT does not provide anything with which to implement counters except, perhaps, complex recursive calls maintaining passed numeric variables where on the innermost loop you effect the desired result based on the incremented value. In my XSLT teaching I see students who are programmers coming to my class after attempting to solve these kinds of problems in programming approaches that are not at all necessary for most of the counting requirements. These contorted solutions have all, so far, been replaced with one-instruction solutions. If you want to use XSLT then you'll have to use the facilities that are provided for you, and the designers have given us a lot of power in this area. I hope this helps. ....................... Ken
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-11-X Practical Formatting Using XSL-FO Member of the XML Guild of Practitioners: http://XMLGuild.info Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|