[xsl] xsl conditional: finding the right node

Subject: [xsl] xsl conditional: finding the right node
From: Allin Cottrell <cottrell@xxxxxxx>
Date: Thu, 12 Feb 2004 21:21:31 -0500 (EST)
Sorry if this is confused, but I'm new to xsl.

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".

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.

One could explicitly write this down ("needs-table=true|false") as an
attribute of each "command", but I would rather automate it.  I'm
trying to figure out how XSL can know the answer before it reaches the
elements that would need a prior table-start -- and, of course, re-set
the answer when the next "command" comes along.

The pseudo-code for what I'm trying to implement is something like:

Find a "command" element
  Read ahead to see if a table is wanted (does this node have any
                     children of a certain sort?)
    Output basic command info, before table
    Output table-start if wanted
      Output table rows if applicable ...
    Output table-end if wanted
    Continue processing rest of command node

Next command...

-- 
Allin Cottrell
Department of Economics
Wake Forest University, NC

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread