[xsl] xslt 2.0 castable as

Subject: [xsl] xslt 2.0 castable as
From: David.Pawson@xxxxxxxxxxx
Date: Mon, 2 Feb 2004 08:52:21 -0000
I have a few strings of this nature

<ientry2>unit: see unit abbreviations</ientry2>
<ientry1>alphabets,  non-Roman, 5.7, 7.5.10, Appendix I</ientry1>
<ientry1>at, commercial sign for, 2.6, 7.2.8-10</ientry1>

which are index contents.

I'm trying to separate the term from the targets,
and using castable as to test for the 'first' numeric term, if there is one.

process is

tokenize the string

then test 
  if (. castable as xs:float)

I *thought* this would return true if the value, when cast,
returned a valid float.
e.g.  2.6 returns true, non-Roman returns false. Seems sensible.

spec says:

XPath provides a form of Boolean expression that tests whether a given value
is castable into a given target type. 

Note the phrasing, 'value', not type. Saxon seems to be telling me
that xs:string is castable as a float.

I found, saxon 7.8, that ('non-roman' castable as xs:float) returns true.

I then tried if (xs:float('non-roman')) which,
though getting ridiculous, actually returns what I want.

Is my logic right, or flawed please?

Regards DaveP.

**** snip here *****


NOTICE: The information contained in this email and any attachments is 
confidential and may be privileged. If you are not the intended 
recipient you should not use, disclose, distribute or copy any of the 
content of it or of any attachment; you are requested to notify the 
sender immediately of your receipt of the email and then to delete it 
and any attachments from your system. 

RNIB endeavours to ensure that emails and any attachments generated by 
its staff are free from viruses or other contaminants. However, it 
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments. 

Please note that the statements and views expressed in this email and 
any attachments are those of the author and do not necessarily represent 
those of RNIB. 

RNIB Registered Charity Number: 226227 

Website: http://www.rnib.org.uk 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread