RE: [xsl] XPath statement for traversing a nested node structure

Subject: RE: [xsl] XPath statement for traversing a nested node structure
From: "Kenny Akridge" <kakridge@xxxxxxxxxxxxx>
Date: Wed, 4 Feb 2004 16:23:36 -0500
If you are looking for a simple count of each object within a node(not a
sum of objects that includes the table subnode), then both of these will

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
	<xsl:for-each select="//TABLE">
		<xsl:value-of select="concat(count(DPROW/OBJECT),

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
	<xsl:apply-templates select="//TABLE"/>

<xsl:template match="TABLE">
	<xsl:apply-templates select="DPROW"/>

<xsl:template match="DPROW">
	<xsl:value-of select="concat(count(OBJECT), '&#160;')"/>

However, if you need the sum then you will need to use some
recurision(off hand this is what I am thinking).

I think your problem with DPROW/OBJECT is that you are getting a count
based on the first table context.

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of scott
Sent: Wednesday, February 04, 2004 2:40 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] XPath statement for traversing a nested node structure

I need some assistance with traversing a nested xml input file

I need to determine between the begining of one nested structure and 
another the number of occurances of a particular element.


<TABLE><DPROW><OBJECT></OBJECT></DPROW></TABLE> would yield an occurance

of one OBJECT element using the XPath statement DPROW/OBJECT.

The above XPath statement falls apart though when I introduce nested 

Inner most TABLE element has two OBJECT elements and the outer TABLE 
element would yield one OBJECT element.

What is a valid XPath statement need for traversing the nested xml 
structure above?

Any help would be greatly appreciated.

- Scott

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread