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 14th, 2007, 08:52 AM
Authorized User
 
Join Date: Mar 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Extracting a Substring from the element.

Hi,

I have an element of the type :

<stra>At Expiry</stra>

I would like to extract 'Expiry' as the value.How can I do this
in XSLT.

I am currently using this:

<xsl:call-template name="output">
<xsl:with-param name="name">Pay Type</xsl:with-param>
<xsl:with-param name="value"><xsl:value-of select="stra"/></xsl:with-param>
</xsl:call-template>



 
Old March 14th, 2007, 09:17 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It depends on what you know about the input. If you know it says "At Expiry" then you don't need to look at the input at all, just write "Expiry" to the output. If you want everything from the fourth character, use substring(). If you want everything after the first space, use substring-after().


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding element to the previous element dani1 XSLT 5 September 10th, 2008 01:38 AM
how to cut a substring petergoodman XSLT 2 July 17th, 2008 06:29 AM
substring in c# sudhirbharti C# 1 February 21st, 2008 01:29 PM
SubString prasanta2expert Access VBA 1 November 17th, 2006 10:04 AM
adding of element and assigning to one element sushovandatta XSLT 2 November 16th, 2004 07:04 PM





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