[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Repetitive variable definitions
Dan,
In XSLT 1.0 I might use a template in a mode to do the color assignment I wanted for the tr and td elements. Then I would only have to count columns in those templates (maybe one template could do for both) and in the template matching the table. In XSLT 2.0, I might write a function that returned the column count of a table for any element inside it. Either way, I might find this XPath expression to be useful: ancestor-or-self::table/tr[1]/td[last()]/@col Also, depending on how snarly it got I might simply avoid assigning variables altogether, and just do the XPath operations directly. (There's often not much point to declaring a variable you use only once.) Note that certain assumptions are being made here about the input. Any cells spanning columns might throw this off. Similarly, let's hope you're not concerned about special requirements for tables inside tables. I hope this helps, Wendell XML: ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|