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 December 24th, 2005, 04:06 PM
Authorized User
 
Join Date: Sep 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Manipulating strings

ok let's say i have an xml file like this

Code:
<index>
<p>Introduction 109 Author Message 200 About 334</p>
</index>
I need to write an xslt that can make that paragraph looking like this

Introduction 109
Author Message 200
About 334

I'm not sure how can i do this...My guess is that I need to look for a number and when i find the number put an end line and keep doing this till i get to the end..

i think this is the idea but i don't know how to implement it on xslt

 
Old December 26th, 2005, 03:22 AM
Authorized User
 
Join Date: Apr 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi

try this one

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
                        <xsl:apply-templates/>
    </xsl:template>


    <xsl:template match="indexes">
                <xsl:for-each select="index/p">

                                <xsl:analyze-string select="." regex="([A-z ]+)([0-9]+)">
                                        <xsl:matching-substring>

                                                            <xsl:value-of select="regex-group(1)"/><xsl:value-of select="regex-group(2)"/><br/>
                                        </xsl:matching-substring>
                                </xsl:analyze-string>
                </xsl:for-each>
    </xsl:template>


</xsl:stylesheet>


 
Old December 27th, 2005, 10:52 AM
Authorized User
 
Join Date: Sep 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you very much, that answered my question






Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating Processes ? kush28 C# 1 October 26th, 2005 04:49 AM
Manipulating DataColumn BSkelding VB.NET 2002/2003 Basics 1 January 28th, 2005 12:11 PM
Manipulating the XML File jyoti_khera XML 1 January 11th, 2005 05:21 AM
Manipulating the data in db dungey PHP Databases 4 January 6th, 2005 11:31 AM
Manipulating Windows bjackman Access VBA 1 November 19th, 2003 02:26 PM





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