[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Best way of testing Hexadecimal value [xslt 1.0]

Subject: Re: Best way of testing Hexadecimal value [xslt 1.0]
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 26 Aug 2010 12:30:44 +0100
Re:  Best way of testing Hexadecimal value [xslt 1.0]
On 26/08/2010 10:30, pankaj.c@xxxxxxxxxxxxxxxxxx wrote:
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.

<label>#x2022</label><!--  HEXADECIMAL FOR BULLET  ACTUALLY WITH

   <xsl:template match="label">
         <xsl:when test=".='.'"><!-- ='.' IS LITERAL BULLET SYMBOL  -->

If you don't want to use a bullet character you can use the numeric reference, just as your source has done and test

. = '& # x 2 0 2 2 ;'

It's not really clear if that is what you are asking?

         <!--  Do Something here  -->
         <xsl:when test=".!='.'"><!-- ='.' IS LITERAL BULLET SYMBOL  -->

xsl:otherwise is of course more efficient than testing the negation which is repeating the test done in the previous clause.
         <!--  Do Something different here  -->
<xsl:copy-of select="@*"/>

<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>.
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.

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.



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.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.