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

Matching on Commas and Full Stops

Subject: Matching on Commas and Full Stops
From: Nigel Byrnes <byrnes@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 09 Feb 1999 11:27:04 +0000
commas and full stops
Hi again all

When formating the contents of a text node, I want to achieve the sematics of the following regular expression:

s/([,\.])\s*/$1\n/g;

That is, on the occurance of a comma or fullstop, insert a line-feed (replacing any following whitespace). I have attempted (but
failed) to do achieve these semantics in xsl by the following:

<xsl:template match="contactAddress">
  <!-- this fails for two reasons: -->
  <!-- 1. The comma is an "unexpected token" -->
  <!-- 2. The fullstop/period is interpreted as the current node -->
  <xsl:if test=",|.">
    <xsl:apply-templates/>
    <BR></BR>
  </xsl:if>
</xsl:template>

<xsl:template match="contactAddress">
  <!-- Try and use XML entities -->
  <!-- Fails because XT believes these entities are undefined -->
  <xsl:if test="&comma; | &period;">
    <BR></BR>
    <xsl:apply-templates/>
  </xsl:if>
</xsl:template>

Does the answer lie in the functions defined in section 2.6.2 of the current XSL WD. Any ideas?

Thanks in advance

Nigel

--
      Nigel Byrnes

                               "We continue..." Pete Tong

Software Engineering and Applications Group,
Philips Research Labs,
Redhill.                           Tel: +44 (0)1293 815578
RH1 5HA.                           Fax: +44 (0)1293 815024
UK.                                GSM: +44 (0)7899 940391
                    Email: byrnes@xxxxxxxxxxxxxxxxxxxxxxxx



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.