Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2009, 12:49 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default Matches help

Hi all,

I have the following text and i want to just extract the word Business using either regular expression, matches, analyze string or something like that

[[TD nowrap align="left" valign="bottom"]]
[[A HREF='#101']]Business[[/A]]
[[/TD]]

Any ideas?

Regards.
 
Old August 11th, 2009, 03:02 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

where $item = the string of text above

<xsl:analyze-string select="$item" regex="\][A-Za-z]*\[">
<xsl:matching-substring>
<xsl:value-of select="substring-after(substring-before(.,'['),']')"></xsl:value-of>
</xsl:matching-substring>
</xsl:analyze-string>


IS there a better way?

Regards,

John
 
Old August 11th, 2009, 03:39 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

What about matching on a series of words?
 
Old August 11th, 2009, 04:58 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

What about a regex for this:

Market for Registrant’s Common Equity,
Related Stockholder Matters and Issuer Purchases of Equity

With the ' and , not having to be there all the time

All the ones i've tried make my stylesheet go into an endless loop

Last edited by JohnBampton; August 11th, 2009 at 05:23 AM..
 
Old August 11th, 2009, 10:03 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to be clearer about the requirement. What parts of your input are fixed and what parts are variable? How much flexibility does the code have to cope with?
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to get multiple matches iinf BOOK: Beginning Regular Expressions 1 October 9th, 2008 02:18 PM
Displaying 1 to 9 of 9 matches kumiko Classic ASP Basics 2 February 21st, 2008 05:12 PM
matches without repeated items pongup BOOK: Beginning Regular Expressions 0 April 7th, 2007 09:05 PM
Select node whose child value matches Fantmx XSLT 5 February 16th, 2007 04:54 PM
Make sure the class defined in this file matches . Tawanda BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 September 20th, 2006 07:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.