Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 26th, 2005, 02:31 PM
Registered User
Join Date: Jul 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Weird Problem with XML Validation using SaxonB

This is part of the XML, where we cannot stat a file we leave the size="UNDETERMINED" to tell us that we could not find it.

<File name="datagrid1" size="UNDETERMINED" getFileSizeStatus="No such file or directory (errno=2)"/>

In the XSLT when I am using

<xsl:variable name="UNDETERMINED_Filesize" select="count(//InputFile/File/@size[.='UNDETERMINED'])" />

saxonB is throwing a validation error:

Validation error
FORG0001: Cannot convert string "UNDETERMINED" to a double
Transformation failed: Run-time errors were reported

If we used xsltproc instead of saxonB it does not throw this error. But I want to use SaxonB as my XSLT processor. So, Is there some way while using saxonB to ignore the validation? Any help on this will be really appreciated.

I also forgot to say that the problem is with the attribute size in the xml. If it was not size, but something like sz it would have worked well in Saxon too. So is there a way to leave size as the attribute but let it be anything like text also (like in my case)?

I saw that you were talking about this validation in Saxon XSLT and XQuery Processor mailing lists, but there was solution in it.
Thanks again for all your help with other questions.
  #2 (permalink)  
Old October 27th, 2005, 03:14 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

I'm a bit puzzled by this problem: you haven't shown enough information. Is there a schema? If so, how is the @size attribute defined? I wouldn't expect to see this error if there is no schema (the xs:decimal must come from somewhere!). If there is a schema then I wouldn't expect your source document to pass validation; and I wouldn't expect it to do anything on Saxon-B as distinct from Saxon-SA.

Please note that type-checking is very different between XSLT 2.0 processors and XSLT 1.0, although a 2.0 processor should fall back to behaving in a very similar way to a 1.0 processor when the data is untyped and unvalidated.

Please supply more information about your source document, stylesheet, and schema.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #3 (permalink)  
Old October 27th, 2005, 02:26 PM
Registered User
Join Date: Jul 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

I found the problem. There was a line (the one below) which did a sum without validation check to make sure it is not decimal. The worst part is that when I used XSLT Cooktop with MSXML as the engine, it never errored out. I am glad I started using Saxon (Thank you for that).

The only problem I had with the Saxon was that it did not tell me the line number where the validation error happened. My XSLT code is around 1600 lines, so it was difficult to look for it without the line number. But anyways thanks for your help and for a good xslt processor.

<xsl:variable name="TestNumberOfBytes" select="sum(//InputFile/File/@size)" />

Similar Threads
Thread Thread Starter Forum Replies Last Post
XLS with XML containing JSP tags dom4j - weird! azudio XSLT 2 May 24th, 2006 08:32 AM
xml validation-namespace is problem asap XML 2 April 26th, 2006 02:56 AM
weird problem! Please Help johnjohn Classic ASP Databases 5 December 21st, 2004 10:27 AM
Weird Access Problem MattyJ Access 2 October 1st, 2004 02:10 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.