[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Node positions with xsl:number count="" level="MULTIPL

Subject: Node positions with xsl:number count="" level="MULTIPLE" - AND position()
From: Bill Shaw - EBCX <BillShaw@xxxxxxxxxxxxxxxxx>
Date: Thu, 28 Dec 2000 07:39:43 -0700
xsl number count
I have an XML with a similar structure:
<root>
<dept>

<agency>
	<agency>
	</agency>
	<agency>
	</agency>
	<agency>
	</agency>
</agency>
<agency>
	<agency>
	</agency>
	<agency>
	</agency>
	<agency>
	</agency>
</agency>   ....... and so on

</dept>
</root>

When I need to access a particular "sub" agency within a certain "parent"
agency, I need the count of the parent agency and the count of the child
agency.  I have been able to get the count using <xsl:number count="agency"
level="multiple"/> ... so say I am on the 45th parent agency node and 3rd
child agency node, the count returns 45.3 (which is exactly what I need).
Now my problem is using the 45.3 in my second style sheet to get to child 3
of the 45th parent node.  In my second style sheet where I try to use the
count produced by the first style sheet, I have the following partial code:

<xsl:apply-templates
select="./agency[position()=$mainDept]/agency[position()=$subDept]">

I am currently breaking the string apart in VB and passing them in as params
which is working but I feel sure there is an easier XSL way (which I stumped
to find so far).


Below is an abbreviated sample of the 1st stylesheet getting the count:

<xsl:template match="agency">
	<xsl:choose>
		<xsl:when test="ancestor::agency">
			<a class="sub"><xsl:attribute
name="href">/deptmap.asp?link=<xsl:number count="agency"
level="multiple"/></xsl:attribute><xsl:apply-templates select="display[@lang
= $language]"/></a><br/>&#xD;
		</xsl:when>
		<xsl:otherwise>	
			<a class="main"><xsl:attribute
name="href">/deptmap.asp?link=<xsl:number
count="agency"/></xsl:attribute><xsl:apply-templates select="display[@lang =
$language]"/></a><br/>&#xD;
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>	


Any and all help is greatly appreciated!

Sincerely,
 
Bill Shaw
301 W. Jefferson, Suite 400
Phoenix, AZ 85003-2157
ph:  602-506-7919
fax: 602-506-5864
 
<http://www.maricopa.gov>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.