XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
jawdat mansourSubject: xsl concat
Author: jawdat mansour
Date: 23 May 2007 12:33 PM
I would like to test (in XSL) for the ending of a string as such:
if the string ends with the letter 's' then append to the end an apostrophe, otherwise append 's . Would anyone please help with how do I build the string/ test for that.

Posttop
Tony LavinioSubject: xsl concat
Author: Tony Lavinio
Date: 23 May 2007 05:01 PM
Originally Posted: 23 May 2007 04:59 PM
There are shorter ways to do this, especially if you are using XSLT 2,
but here is one way that should show the steps cleanly.

<xsl:value-of select='.'>
<xsl:text>'</xsl:text>
<xsl:ifn test="substring(., string-length(.)) != 's'">
<xsl:text>s</xsl:text>
</xsl:if>

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.