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

XPATH problem

Subject: XPATH problem
From: "Bradley, Peter" <pbradley@xxxxxxxxxx>
Date: Fri, 7 Nov 2008 12:48:05 -0000
 XPATH problem
Hi guys,

This is related to a query I had some weeks ago (in case it sounds
familiar to someone).

I am processing a document that comes from a database.  Its structure is
that it has an <Institution> document element.  The <Institution>
element has <Module>, <Course>, and <Student> elements.

The <Student> element contains - amongst other things - a <HUSIC>
element (simple type and key from the student table), an <FNAMES>
element (simple type), and an <Instance> element.

The <Instance> element has, amongst other things, a <REDUCEDI> element.

I'm processing the source data using <xsl:for-each> elements in the xsl.
The current code I am writing is withing such and element as follows:

<xsl:for-each select="s0:Institution/s0:Student">
	...
</xsl:for-each>

In the xsl, I want to express the notion that an <FNAMES> element should
only be included where there exists a <REDUCEDI> element in an any
<Instance> below the current <Student> having a value of '00' or '04'.

This should result in the exclusion of this element for 45 students.

First of all, I tried the following:

<xsl:for-each select="s0:Institution/s0:Student">
	...
	<xsl:if test="s0:Instance/REDUCEDI[.='00' or .='04'">
		<FNAMES>
			...
		</FNAMES>
	</xsl:if>
	...
</xsl:for-each>

This resulted in an <FNAMES> element being present for every student
including the 45 whom we knew were code '03' in their associate
Instance/REDUCEDI elements.

Next I tried:

<xsl:for-each select="s0:Institution/s0:Student">
	...
	<xsl:if
test="/s0:Institution/s0:Student[s0:HUSID=current()]/s0:Instance/s0:REDU
CEDI[.='00' or .='04']">
		<FNAMES>
			...
		</FNAMES>
	</xsl:if>
	...
</xsl:for-each>

This resulted in no students having an <FNAMES> element.  I.e. the
output document never contained an <FNAMES> element for a <Student>

Can someone spot where my XPATH statements are going astray, please?

Many thanks,


Peter

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.