|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xsl conditional: finding the right node
> 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.
There is no before and after with XSLT. It gets the information you ask
for at a time of its own choosing. And there is certainly no "resetting"
of anything.
>
> 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
>
Try to rewrite the pseudo-code as a description of the desired result
rather than as an algorithm. "The output contains for each command,
basic command info, an optional table which is produced only if the
command has children of a certain sort, followed by remaining command
info".
If you want to know whether the current element has an X child, just
write
<xsl:if test="child::X">...</xsl:if>
Michael Kay
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
|

Cart








