[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Complex condition
Subject: [xsl] Complex condition From: "Bradley, Peter" <pbradley@xxxxxxxxxx> Date: Wed, 1 Oct 2008 11:33:53 +0100 |
Hi (yes it's me again!) I have a complex condition to sort out. At the moment, I have (incorrectly): ... <!-- NULL is valid for PHDSUB --> <xsl:if test="/s0:HesaSqlExplicit_Response/s0:Institution/s0:Course/s0:COURSEAIM /text() = 'D00'"> <PHDSUB> <xsl:if test="s0:PHDSUB/text()"> <xsl:value-of select="s0:PHDSUB"/> </xsl:if> <xsl:if test="not(s0:PHDSUB/text())"> <xsl:attribute name="ReasonForNull"> <xsl:text>9</xsl:text> </xsl:attribute> </xsl:if> </PHDSUB> </xsl:if> ... (I know the text() instances are redundant following our discussions yesterday. I haven't had chance to weed them all yet) The PHDSUB element lives in a complex element called 'Instance'. This is related to other complex elements like this: HesaSqlExplicit_Response | | +-- Institution (0:1) | | +-- Student (1:unbounded) | | | | | +-- Instance (1:unbounded) | +-- Module (1:unbounded) | | +-- Course (1:unbounded) Instance contains, amongst other things, the simple elements PHDSUB element and COURSEID. Course contains the simple elements COURSEID and COURSEAIM. The condition I'm trying to express is that a PHDSUB should only appear in the output tree if the COURSEAIM element in Course has the value 'D00' and where (the bit that I'd not accounted for) the COURSEID element of Course is equal to the COURSEID element of the the current Instance. Obviously at the moment my condition only looks at the COURSEID in, presumably, the first Course that it comes to - which happens to equal 'D00' and so the condition is always returning true. Not what I want. I guess I need a predicate. So am I on the right track looking at something like: test="/s0:HesaSqlExplicit_Response/s0:Institution/s0:Course[s0:COURSEID = ./s0:COURSEID]/s0:COURSEAIM = 'D00'" ?? I don't know - amongst lots of other things I don't know - whether this distinguishes between 'Instance.COURSEID' and 'Course.COURSEID'. And I'm not at all sure of the predicate because to the best of my remembrance I've never used one before in anger. Thanks Peter
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xslt2: Retrieving a direc, Yves Forkl | Thread | Re: [xsl] Complex condition, David Carlisle |
[xsl] xslt2: Retrieving a directory, Yves Forkl | Date | RE: [xsl] xslt2: Retrieving a direc, Michael Kay |
Month |