Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: David Carlisle <davidc@--------->
To:
Date: 4/1/2004 12:19:00 AM
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
________________________________________________________________________


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent