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

RE: XSLT 2.0 Matching characters above 255

Subject: RE: XSLT 2.0 Matching characters above 255
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Tue, 1 Mar 2005 15:13:21 -0000
xsl codepoints to string
For something I thought not possible - 2 answers :)

I'm guessing the string-to-codepoints() would be much faster, so I'll
use that.

For the archive (and maybe the FAQ DaveP?):

string-to-codepoints():

<xsl:template match="text()">
  <xsl:for-each select="string-to-codepoints(.)">
    <xsl:choose>
      <xsl:when test=". > 255">
 	  <span style="font-family:Code2000">
          <xsl:value-of select="codepoints-to-string(.)"/>
        </span>
	</xsl:when>
	<xsl:otherwise>
	  <xsl:value-of select="codepoints-to-string(.)"/>
	</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:template>

analyze-string:

<xsl:template match="text()">
  <xsl:analyze-string select="." regex="[&#xFF;-&#x10FFFF;]+">
    <xsl:matching-substring>
      <span style="font-family:Code2000">
	  <xsl:value-of select="."/>
      </span>
    </xsl:matching-substring>
    <xsl:non-matching-substring>
      <xsl:value-of select="."/>
    </xsl:non-matching-substring>
  </xsl:analyze-string>
</xsl:template>


Thanks David and Mike,
andrew

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.