[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] xslt 2, design patterns


Subject: RE: [xsl] xslt 2, design patterns
From: "Pawson, David" <David.Pawson@xxxxxxxxxxx>
Date: Mon, 4 Oct 2004 11:43:51 +0100

    From: David Carlisle 
    
      It depends a bit on the detail I think. In general I would go for
    
      <xsl:choose>
      <xsl:when test="matches(., regex1)">...
      <xsl:when test="matches(., regex2)">... 
     <xsl:otherwise>...
    
      But there may be cases where using 
    xsl:non-matching-substring works better.

I like the structure there, for readability.
I (so far) prefer non-matching for less than 3 cases.

    
      Michael Kay
    
    Also of course (subject to not blowing your system's regexp 
    stack)  you can always make a regexp that matches them all 
    at the same time
    
      (regex1)|(regex2)|(.*)
    
    You can tell which one you actually got by looking at the 
    subgroup matches.

Readability David?
  regex's look pretty horrendous sometimes, 
but I guess it would work if they were in variables.

Thanks.

regards DaveP

-- 
DISCLAIMER:

NOTICE: The information contained in this email and any attachments is 
confidential and may be privileged.  If you are not the intended 
recipient you should not use, disclose, distribute or copy any of the 
content of it or of any attachment; you are requested to notify the 
sender immediately of your receipt of the email and then to delete it 
and any attachments from your system.

RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants.  However, it 
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email and 
any attachments are those of the author and do not necessarily represent
those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk


Current Thread