Subject: [xsl] String ends with ?, ! or not From: "Pankaj Chaturvedi" <pankaj.chaturvedi@xxxxxxxxx> Date: Tue, 29 Apr 2008 17:34:23 +0530 |
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‐curve?</articletitle> I am trying to test, whether the <articletitle> string ends with ? (?) or not. Below is what I've tried to define in my stylesheet (note that I've tested Unicode value for ? as it gives error to define an external entity ?, 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')"> <char><xsl:text> </xsl:text></char> </xsl:when> <xsl:otherwise> <char><xsl:text>, </xsl:text></char> </xsl:otherwise> </xsl:choose> Question: contains() function just whether string has '?' in it or not, which means it will be true for strings like "XXXXXXX The J‐curve? YYYY", whereas I need to check whether it ends with or not (Alas I do not know any functions apart from starts-with()). Any suggestions please in this regard. Pankaj Best, Pankaj Chaturvedi ============================================================================ ================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Working with Collections, XSL-List Owner | Thread | Re: [xsl] String ends with ?, ! or , Martin Honnen |
Re: [xsl] Problem with iterating th, Florent Georges | Date | Re: [xsl] String ends with ?, ! or , Martin Honnen |
Month |