Subject: Re: [xsl] Best way of testing Hexadecimal value [xslt 1.0] From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 26 Aug 2010 12:30:44 +0100 |
Hello all,
I just did the following test for one of the requirement in my stylesheet. Though I am able to get the correct result but somehow I am not convinced with the approach. There must be better/correct way of doing this.
source ===== <label>#x2022</label><!-- HEXADECIMAL FOR BULLET ACTUALLY WITH 'AMPERSAND' AND ; ADDED TO IT -->
Test ==== <xsl:template match="label"> <xsl:copy> <xsl:choose> <xsl:when test=".='.'"><!-- ='.' IS LITERAL BULLET SYMBOL -->
<!-- Do Something here --> </xsl:when> <xsl:when test=".!='.'"><!-- ='.' IS LITERAL BULLET SYMBOL -->
you can test if number(.)=number(.) If the string represents a number, this is true, if it is a non number it is the test NaN = NaN which is false.<!-- Do Something different here --> </xsl:when> </xsl:choose> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:when test=".= 'BULLET SIGN'"> doesn't seems to be nice to me. Is there any better way to test hexadecimal values. Apart from this is there a way of testing whether string is a digit or character<label>1.</label> <label>a.</label>.
david
Not tested:
I believe<xsl:when test=".='BULLET SIGN'"> will check for the literal string instead of something like [A-Za-z0-9]. I am using XSLT 1.0.
Any thoughts will be appreciated.
TIA, Pankaj
________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Best way of testing Hexad, pankaj . c | Thread | Re: [xsl] Best way of testing Hexad, Mukul Gandhi |
Re: [xsl] Best way of testing Hexad, pankaj . c | Date | Re: [xsl] Best way of testing Hexad, David Carlisle |
Month |