Subject: Re: [xsl] Counting indent level From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 29 Sep 2008 08:47:40 -0400 |
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>
The reason for that is that a item node might also contain child nodes that are also called <item> nodes that I don't want. I only want a item node that has it's immediate parent a group node.
Every node (except the root node above the document element) has only a single parent node, so I'm not sure what you mean by "immediate parent". Unless you meant to say "immediate ancestor" which is the parent.
Above you also state you want an item whose parent is catalogue and not just those whose parent is group. If I'm wrong, then you'll have to change the above to the following to not process items that are not a child of a group:
<xsl:template match="catalog"> <xsl:apply-templates select="*"/> </xsl:template>
This is the same as the above, the first three lines at least - is that what you meant?
The code I give you above will process groups and items in document order.
Ken, does this mean it will retain the overall order though?
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 :
item group group item item etc
So it's one single export with both types mixed in the original order. This is why I used a single for-each with the "or" to pick up everything in one go.
-- 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Counting indent level, Michael Kay | Thread | Re: [xsl] Counting indent level, Nicholas Orr |
Re: [xsl] Still thinking to object , Jonas Bassl | Date | Re: [xsl] Still thinking to object , David Carlisle |
Month |