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 March 6th, 2009, 05:05 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Unfortunately you've only described your transformation by means of one or two examples; it's difficult to infer the general rules from that.

In many cases it's possible to apply regular expression processing to individual text nodes, in which case you need to process the markup down to leaf node level using xsl:apply-templates, and then use xsl:analyze-string only when you get to the text nodes.

In some cases you need to process a piece of content containing text and markup as a whole. There are two strategies for this, neither of them particularly easy.

One is to start by converting the markup to text, for example, convert H<sub>2</sub>O to H\2/O (using some suitable characters that won't confuse things, eg Unicode private use characters). You can then use regex processing on the whole string (using analyze-string), putting markup back where needed.


The other approach is to convert all the structural markers in the text to markup, for example change "[ABC1980]" to <cite>ABC1980</cite> which you can then process as a tree in the normal way.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
rajashekhara (March 6th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using for-each-group in an XSLT statement Kayan XSLT 2 January 16th, 2009 12:52 PM
regex in xslt rajesh_css XSLT 4 September 29th, 2008 11:35 PM
XSLT simulation of two column Group By wholden XSLT 2 March 31st, 2008 08:57 AM
How to group xsl elements in xslt.10 suji XSLT 1 February 29th, 2008 03:44 AM
Regex Problem claudew BOOK: ASP.NET Website Programming Problem-Design-Solution 2 June 5th, 2004 07:55 PM





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