xsl-list
[Top] [All Lists]

Re: xslt 2, design patterns

2004-10-04 03:52:37

  Readability David?

beauty is in the eye of the beholder...

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

Actually if you are matching the whole string I would use an xsl:choose
with matches() as Michael showed.

The main advantage in pushing them all into a single big regexp 
is if you are using it with analyze-string and you want to match all
occurrences of any of the regexps. 

If you do it all in one go it looks a bit horrendous but actually works
quite simply, if on the other hand you do it "one at a time" then after
the first case your original string already has some element nodes
coming from the earlier replacements (or depending how you iterate) you
are just handling the non matching fragments not the entire string.

See for example the big regexp in my htmlparse stylesheet that I think
you cite in your xslt2 faq area.

David



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


<Prev in Thread] Current Thread [Next in Thread>