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 May 20th, 2007, 07:27 AM
Authorized User
 
Join Date: Apr 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Do I need regular expressions..?

I have a piece of XML:

Code:
<element>
   Blah blah $P{foo} blah blah blah $P{bar}...
</element>
and I want to search it for every occurence of "$P{X}" and get "X", eg. get something similar to:

Code:
<root>
   <el>foo</el>
   <el>bar</el>
   ....
</root>
Do I need regular expressions to handle that..?

 
Old May 20th, 2007, 07:32 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

No, but using version XSLT 2.0 would be easier. In version 1.0 you can use substring-before and substring with a recursive template to grab all the required content. Search for an example of a string replace XSLT template which should give you a good basis from where to start.

--

Joe (Microsoft MVP - XML)
 
Old May 20th, 2007, 05:09 PM
Authorized User
 
Join Date: Apr 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great that did the job, thanks for the help!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expressions mega Beginning PHP 1 February 5th, 2007 05:31 PM
Regular expressions on C# hideway C# 2 November 27th, 2006 05:08 PM
I need some help in regular expressions! marwaesmat Perl 2 March 7th, 2006 05:22 PM
regular expressions help kyootepuffy Classic ASP Databases 2 September 10th, 2003 01:37 PM
Regular Expressions Dave Doknjas C# 1 August 9th, 2003 12:05 AM





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