Subject: Re: [xsl] Implementing a (fairly) complex business rule From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 30 Sep 2008 14:30:56 +0100 |
It's best to say if you want xslt 2 or 1 since for example > if the value of the DOMICILE element is in a list of > values comprising XG, XH, XI, XK, XL, GG, JE and IM can be expressed in xpath2 as s0:DOMICILE=('XG', 'XH', 'XI', 'XK', 'XL', 'GG', 'JE', 'IM') which makes things look neater string-length(s0:POSTCODE/text() = 0)" text nodes always have string length greater than zero (if they are in a document) If an element has no text then there is no text node not a text node of zero length. You haven't given any indication of the form of your input document, or the current node at the point that you evaluate your posted code, but I'd guess that this is wrong and perhaps the cause of the problem. <xsl:if test="/s0:HesaSqlExplicit_Response/s0:Institution/s0:Student/s0:Instance /s0:REDUCEDI = '00'"> <xsl:if test="s0:DOMICILE='XF' The first test goes back to the root of the document to find s0:REDUCEDI, but is the current node the parent of "s0:DOMICILE and s0:POSTCODE. in xslt2 I'd write something like <xsl:if test="/s0:HesaSqlExplicit_Response/s0:Institution/s0:Student/s0:Instance /s0:REDUCEDI = '00'"> <xsl:if test=" s0:DOMICILE=('XG', 'XH', 'XI', 'XK', 'XL', 'GG', 'JE', 'IM')"> <xsl:copy-of select="s0:POSTCODE"/> <xsl:if test="empty(s0:POSTCODE)"> <POSTCODE ReasonForNull="1"/> </xsl:if> </xsl:if> But again, it's not possible to say if this is right or not without knowing what the source looks like. David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Implementing a (fairly) compl, Bradley, Peter | Thread | RE: [xsl] Implementing a (fairly) c, Bradley, Peter |
[xsl] Implementing a (fairly) compl, Bradley, Peter | Date | Re: [xsl] Implementing a (fairly) c, David Carlisle |
Month |