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

RE: How to Tag Several Words in a Given String

Subject: RE: How to Tag Several Words in a Given String
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 12 Oct 2005 08:55:00 +0100
how to tag
Will the strings always be whole words? If so, I would do

<xsl:analyze-string select="String" regex="\s+">
  <xsl:non-matching-substring>
   <xsl:choose>
    <xsl:when test=". = $testStr">
     <validName><xsl:value-of select="."/></validName>
    </
    <xsl:otherwise>
     <xsl:value-of select="."/>
    </
   </
  </
</

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: UlyLee [mailto:ulyleeka@xxxxxxxxx] 
> Sent: 12 October 2005 05:26
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How to Tag Several Words in a Given String
> 
> Hello,
> 
> I have this scenario, i have a string:
> 
> <String>Name1 and Name2 becomes Name3</String>
> 
> and have a set of valid strings that needs to tagged
> which i assigned to a variable:
> 
> <xsl:varible name="testStr" as:"xs:string*"
> select="('Name1', 'Name3')"/>
> 
> My desired output should be like this:
> 
> <String><validName>Name1</validName> and Name2 becomes
> <validName>Name3</validName></String>
> 
> I was thinking of using a for-each loop to process the
> matches, but i'm stuck into what procedures i need to
> put in the for-loop:
> 
> <xsl:for-each select="$testStr">
> <xsl:if test="contains(String,.)">
> ???
> </xsl:if>
> </xsl:for-each>
> 
> Am i going in the right direction here? or is there a
> better way to do this?
> 
> -- UlyLee
> 
> 
> 
> 	
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com

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.