Subject: Re: [xsl] xsl conditional: finding the right node|
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Feb 2004 22:08:47 -0500
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
<xsl:for-each select="command"> <xsl:for-each select="basic-command-element-child-stuff"> </xsl:for-each> <xsl:if test="table-stuff-element-child"> <table> <xsl:for-each select="table-stuff-element-child"> ... </xsl:for-each> </table> </xsl:if> <xsl:for-each select="other-stuff"> </xsl:for-each> </xsl:for-each>
-- 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
|<- Previous||Index||Next ->|
|[xsl] xsl conditional: finding the , Allin Cottrell||Thread||Re: [xsl] xsl conditional: finding , Allin Cottrell|
|[xsl] xsl conditional: finding the , Allin Cottrell||Date||Re: [xsl] xsl conditional: finding , Allin Cottrell|