Subject: [xsl] XPATH problem From: "Bradley, Peter" <pbradley@xxxxxxxxxx> Date: Fri, 7 Nov 2008 12:48:05 -0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] writing new values to an , dvint | Thread | Re: [xsl] XPATH problem, David Carlisle |
Re: [xsl] Tool for transforming fil, Florent Georges | Date | Re: [xsl] writing new values to an , dvint |
Month |