[Home] [By Thread] [By Date] [Recent Entries]
At 2004-02-12 21:21 -0500, Allin Cottrell wrote:
I'm processing a long list of elements (a command reference for a computer program). The enclosing element is "commandlist" and the individual element is "command". Fine. My problem is this: when I process each "command", I need to check whether or not it has any sub-elements (arguments, options) of a sort that would require a display table to be built. XPath tests can return true/false on the presence of child or descendent nodes. That is thinking too much like a serial programmer, and not a hierarchical processor. Think branches and leaves, or better still, parents, children, siblings, ancestors and descendants. Try not to think of variables (in XSLT variables do not vary) ... check out the inherent facilities in XSLT for processing hierarchies. The pseudo-code for what I'm trying to implement is something like:
The above takes a "pull approach" to the information ... it is easy but less flexible for specialization ... a "push approach" would use multiple template rules and <xsl:apply-templates/>. It's not hard, but I find my students embrace the pull approach much more quickly and I have to push them to use the push style. I hope this helps. ..................... Ken -- Public courses: upcoming world tour of hands-on XSL training events Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Washington, DC: 2004-03-15 San Francisco, CA: 2004-03-22 Hong Kong: 2004-05-17 Germany: 2004-05-24 England: 2004-06-07 World-wide on-site corporate, government & user group XML training! 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) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



