Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: datatype >Thread Next - Re: datatype Re: datatypeTo: NULL Date: 7/3/2009 8:28:00 AM On Jul 3, 9:43=A0am, Martin Honnen <mahotr...@yahoo.de> wrote: > Larry Sulky wrote: > > On Jul 3, 8:20 am, Martin Honnen <mahotr...@yahoo.de> wrote: > >> I did already suggest > > >> <xsl:variable name=3D"bboxWidth" > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 as=3D"xs:decimal" > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 select=3D"xs:decimal($bboxTokens[3= ]) - > >> xs:decimal($bboxTokens[1])"/> > > >> where xs:decimal($bboxTokens[3]) casts the third item in the $bboxToke= ns > >> sequence to a decimal. > > Your suggestion didn't work at first. It gave me this error: > > > "Type error, value does not match a required type as specified > > by the matching rules in 2.5.4 Sequence Type Matching. > > - 'xs:decimal' " > > > But then I removed the as=3D attribute: > > > <xsl:variable name=3D"bboxWidth" > > =A0 select=3D"xs:decimal($bboxTokens[3]) - xs:decimal($bboxTokens[1])"/= > > > > and then it worked perfectly. So I'm a little confused, but > > grateful! :-) > > I am not sure why you get that error. > When I try this XML document > > <foo bbox=3D"1,2,3,4"/> > > against this XSLT > > <xsl:stylesheet > =A0 =A0xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform" > =A0 =A0version=3D"2.0" > =A0 =A0xmlns:xs=3D"http://www.w3.org/2001/XMLSchema"> > > =A0 =A0<xsl:template match=3D"foo"> > =A0 =A0 =A0<xsl:variable name=3D"bboxTokens" as=3D"xs:string*" > select=3D"tokenize(@bbox, ',')"/> > =A0 =A0 =A0<xsl:variable name=3D"bboxWidth" > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 as=3D"xs:decimal" > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 select=3D"xs:decimal($bboxTokens[3]) = - > xs:decimal($bboxTokens[1])"/> > =A0 =A0 =A0<xsl:value-of select=3D"$bboxWidth"/> > =A0 =A0</xsl:template> > > </xsl:stylesheet> > > then it runs fine with Saxon 9 and AltovaXML tools 2009. > > -- > > =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML > =A0 =A0 =A0 =A0http://msmvps.com/blogs/martin_honnen/- Hide quoted text - > > - Show quoted text - Interesting. With as=3D"xs:string*", your sample works; with as=3D"xs:string" (no asterisk), it does not. Must an asterisk always be appended to the value in the as=3D attribute? | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
