RE: [xsl] Implementing a (fairly) complex business rule

Subject: RE: [xsl] Implementing a (fairly) complex business rule
From: "Bradley, Peter" <pbradley@xxxxxxxxxx>
Date: Tue, 30 Sep 2008 14:37:45 +0100
Thanks David.

I'm sorry I wasn't more specific.  One of the problems I have here is
that the xslt file is very large.  The input document is even larger
(50Mb).  So I'll do what I can to make things clearer.

Firstly, it's xslt 1.0.  It's for a BizTalk application and BizTalk can
only deal with xslt 1.0.

Ah!  I see you've just posted again.  I'll check that out before
replying further.

Cheers


Peter


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: 30 September 2008 14:31
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Implementing a (fairly) complex business rule



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