|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: setting up tables differently based on existance o
Hi Robert,
... <xsl:when test="value and not($col)"> <fo:table-row> <fo:table-cell><xsl:value-of select="title"/></fo:table-cell> <fo:table-cell>text</fo:table-cell> <xsl:variable name="col" select="'true'"/> </xsl:when> <xsl:when test="value and $col"> <fo:table-cell><xsl:value-of select="title"/></fo:table-cell> <fo:table-cell>text</fo:table-cell> </fo:table-row> <xsl:variable name="col" select="''"/> </xsl:when> ... This obviously will not work, because XSLT does not allow variables to be reassigned. Worse: this violates the well-formned requirement of XML. > After reading extensively from O'Reilly's XSLT book and the w3c specs for XSLT and XPath, I decided I could achive my goal with recursive template matches. Here is what I arrived at: Err, why not use "following-sibling::field[2]"? :-)
I'm not sure what you mean by this, but "following-sibling::field[1]" results in a node-set with either one or zero elements named field. So for at most one element a new apply-templates is being issued. It is true that when you have n field siblings, you potentially build up a stack of n apply-templates calls, but it isn't so that all field siblings are stacked each time. There is no need for this. The field nodes are in the source tree and are always available. The things that do need to be cached are the pointer to the current node, the current context list (here in most cases a node-set of only one field node) and variables if you would be using them... At any rate, any ideas on a better way to do this? (Other than a SAX parsing of the XML with a few variables and leaving an extra node in select <field>s.) No, I think it is perfectly sound already... except for the [position() > 1][1], you can simply replace that by [2]... G.
|
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
|






