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 April 15th, 2008, 06:34 AM
Authorized User
 
Join Date: Nov 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to remove numbers in XML files using xsl

HI,


I am translating xml files with xsl...

Input XML file:

<sec><title>1 Introduction</title>
<sec><title>1.1 XY Leo</title>

I want to convert output xml file like below:

Output XML file:

<sec><title>Introduction</title>
<sec><title>XY Leo</title>




Thanks in Advance,
S. Rajamuthukumar

 
Old April 15th, 2008, 06:43 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Write a template for 'title' elements that removes the leading numbers e.g. with XSLT 2.0
Code:
  <xsl:template match="title">
    <xsl:copy>
      <xsl:value-of select="replace(., '^[\d\.]+', '')"/>
    </xsl:copy>
  </xsl:template>
--
  Martin Honnen
  Microsoft MVP - XML





Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove numbers from cell EricB123 Excel VBA 25 August 6th, 2014 01:55 PM
display directories and files using only xsl/xml.. eteune XSLT 1 January 2nd, 2007 07:01 PM
adding up 2 numbers in xsl umair.aziz XSLT 3 July 14th, 2006 09:24 AM
Getting data from xml and xsl files combined hema_latha7 General .NET 0 May 19th, 2006 08:27 AM
Remove letters from numbers Corey Access 7 December 18th, 2005 09:09 PM





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