xsl-list
[Top] [All Lists]

Re: [xsl] String ends with ?, ! or not

2008-04-29 05:11:17
Pankaj Chaturvedi wrote:
Is there is way, we can test whether a string ENDS-WITH a ?, !.

<articletitle>Dynamics of the trade balance and the terms of trade: The
J&hyphen;curve&quest;</articletitle>

I am trying to test, whether the <articletitle> string ends with &quest; (?)
or not. Below is what I've tried to define in my stylesheet (note that I've
tested Unicode value for &quest; as it gives error to define an external
entity &quest;, which I've done by declaring a ENTITY declaration in XML as
<!ENTITY quest            "[#x0003F]" ><!--=question mark --> ).


<xsl:choose>
        <xsl:when test="./articletitle/contains(string(), '#x0003F')">

Are you using XSLT 2.0 and XPath 2.0? That has a function ends-with http://www.w3.org/TR/xpath-functions/#func-ends-with
  <xsl:when test="ends-with(articletitle, '?')">

--

        Martin Honnen
        http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>