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

Implementing a (fairly) complex business rule

Subject: Implementing a (fairly) complex business rule
From: "Bradley, Peter" <pbradley@xxxxxxxxxx>
Date: Tue, 30 Sep 2008 14:07:27 +0100
 Implementing a (fairly) complex business rule
I have a business rule that says that if the value of the REDUCEDI
element is "00" and if the value of the DOMICILE element is in a list of
values comprising XG, XH, XI, XK, XL, GG, JE and IM then a POSTCODE
element must be present.  It should not be present otherwise.

If the POSTCODE element is present and has a NULL value, then a
ReasonForNull attribute should be included, with a value of "1".

If the POSTCODE element is present and has a value, that value should be
output and the ReasonForNull attribute should not be present.

I have expressed this as follows:

<!-- NULL is valid for a postcode -->
<xsl:if
test="/s0:HesaSqlExplicit_Response/s0:Institution/s0:Student/s0:Instance
/s0:REDUCEDI = '00'">
  <xsl:if
  test="s0:DOMICILE='XF' or s0:DOMICILE='XG' or s0:DOMICILE='XH' or
  s0:DOMICILE='XI' or s0:DOMICILE='XK' or s0:DOMICILE='XL' or
  s0:DOMICILE='GG' or s0:DOMICILE='JE' or s0:DOMICILE='IM'">
    <POSTCODE>
      <xsl:if test="string-length(s0:POSTCODE/text() = 0)">
        <xsl:attribute name="ReasonForNull">
          <xsl:text>1</xsl:text>
        </xsl:attribute>
      </xsl:if>
      <xsl:if test="string-length(s0:POSTCODE/text()) > 0">
        <xsl:value-of select="s0:POSTCODE/text()"/>
      </xsl:if>
    </POSTCODE>
  </xsl:if>
</xsl:if>

However, in my output I am getting POSTCODE elements that both have a
value and also have a ReasonForNull attribute with a value of "1".

Can anyone put me out of my misery?  I just cannot see how this can
happen.

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.