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

Re: OT: request help with string-based/ RegEx problem

Subject: Re: OT: request help with string-based/ RegEx problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 1 Apr 2004 11:18:40 +0100
saxon tokenize
  but also entities
  representing a character like this "&#8711;" (up-turned
  delta)

Note that is not an entity reference but a numeric character reference.
In either case (character or entity reference) XSLT will not see the
reference as it is expanded by xml parser before xslt starts.


If you want to do this in xslt (rather than in ant about which I can't
say much)

So your requirent is just to spot one or two letter words.

> The following is a "pseudo regex" expressing this idea:

if you used the XSLT2 draft (as implemented in saxon 7) you could use
such a regex directly.

In XSLT 1 the simplest is first to tokenize your input string based on
white space (extensions such as saxon:tokenize  help here oir use a
recursive template as often posted to this list or in Dimitre's fxsl
library)

The context would be trivial to specify in xslt as you'd just call this
tokenizing code from a suitable template matching the elements where you
want to do the search.

so using saxon:tokenize it would just be something like

<xsl:template match="xref">
<xref>
<xsl:copy-of select="@*"/>
<xsl:for-each select="saxon:tokenize(.)">
 <xsl:choose>
   <xsl:when test="string-length(.) &lt;3"><sym><xsl:value-of select="."/></sym></xsl:when>
   <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
 M/xsl:choose>
<xsl:text> </xsl:text>
</xsl:for-each>
</xref>
</xsl:template>

David

-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. 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
________________________________________________________________________

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.