[Home] [By Thread] [By Date] [Recent Entries]
At 2008-09-29 12:51 +1000, Nicholas Orr wrote:
On 29/09/2008, at 11:38 AM, G. Ken Holman wrote:<xsl:template match="catalog"> <xsl:apply-templates select="*"/> </xsl:template> <xsl:template match="group"> <!--report on the group--> <xsl:apply-templates select="item"/> </xsl:template> <xsl:template match="item"> <!--report on the item--> </xsl:template> Sorry ... if you wanted to skip item children of catalogue then in the top example it would be select="group". The code I give you above will process groups and items in document order. Yes. I want to process them (from my original), as an export (like csv) in the same order so the export would mix and match items and groups : You didn't use "or", you used "union" (yes, there's a difference ... sometimes the union feels like and "or" and sometimes the union feels like an "and" ... your for-each statement could read "items and groups and items that are children of groups" which feels like an "and" and not an "or"). It works for you because the union is returned in document order. But in summary, in your code you are making assumptions about your data while in my code I was focused on the result. I think Mike was very eloquent (as always) in explaining the details of this in his post, especially how the words you put forward lead to a particular approach. . . . . . . . . . Ken -- Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|

Cart



