Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Can xsl throw an exception when value-of xpath does not exist?

Reply
Thread Tools

Can xsl throw an exception when value-of xpath does not exist?

 
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      08-30-2004
In article <>,
inquirydog <> wrote:

[collection of syntax errors elided]


% i am merely requesting that xslt have the same error checking
% capabilities as just about every other language out there (it does in

Well, you're not though. XPath (not XSLT) does catch syntax
errors. What it doesn't catch, like any other language, is incorrect
logic and incorrectly typed data. In this case, you're asking for
an exception to be thrown when an XPath expression returns
an empty node set, and the connection between that and incorrectly
typed expressions is tenuous at best.

% I believe that xslt is the way of the future of development, and am

The future of development of what, exactly? I was thinking about this
problem as I napped through a matinee screening of the Yu Gi Oh! movie
yesterday, and it seems to me that the solution to this problem in XSLT
is the same as the solution in every other language. When you perform a
query against an external data source and you want to throw an exception
when it doesn't return a value, you test for that condition and handle
it the way you want to. If it's too difficult to do this in XSLT, then
perhaps that's a sign that there's a more fundamental problem with XSLT.


--

Patrick TJ McPhee
East York Canada

 
Reply With Quote
 
 
 
 
inquirydog
Guest
Posts: n/a
 
      09-11-2004
(Patrick TJ McPhee) wrote in message news:<>...
> In article <>,
> inquirydog <> wrote:


Sorry I didn't respond all week. I was away on vacation and got
some great relaxation. For now I am back to my xml work....

>
> % i am merely requesting that xslt have the same error checking
> % capabilities as just about every other language out there (it does in
>
> Well, you're not though. XPath (not XSLT) does catch syntax
> errors. What it doesn't catch, like any other language, is incorrect
> logic and incorrectly typed data. In this case, you're asking for
> an exception to be thrown when an XPath expression returns
> an empty node set, and the connection between that and incorrectly
> typed expressions is tenuous at best.



Most other languages do more than catch syntax errors though
(ie- I specifically put in the java example to show such an example- a
missed exception.) I personally believe that the more error checking
the better(sheesh, if I could just get the computer to write the code
for me I would), and think I have found an example of a typical error
that I believe that xslt doesn't catch properly (without way too much
unnecessary work). And I have personally been burned by this very
error in the past. The small change to xslt that I suggested in this
thread (or something like it) would certainly make it easy to avoid
this in the future.

Just to reiterate what I have written earlier, I don't want
xslt to throw an exception for all empty node sets returned, but I am
calling for a simple way to tell xslt to do that if requested.

> % I believe that xslt is the way of the future of development, and am
>
> The future of development of what, exactly?


Software development, of most kinds. I am of the opinion that
xslt is going to revolutionize the way software is written. Unlike c,
c++, java, perl, python, ml and other functional languages, etc., xslt
is a truely data-dentric language. I can do in a page of xslt what
might take double that in the other languages written. xslt is to c,
c++, java what jsp is to servlets, except that jsp's only get half the
picture (easy outputs html data, doesn't easily manipulate data).
Since I've learned about xslt in the last year roughly half of my
programming tasks have turned over to it. And xslt isn't even fully
polished yet, once it is it will be much nicer. The very stuff I am
writting about in this thread needs to get fixed before xslt is going
to be widely adopted as a replacement for other languages.

> I was thinking about this
> problem as I napped through a matinee screening of the Yu Gi Oh! movie
> yesterday, and it seems to me that the solution to this problem in XSLT
> is the same as the solution in every other language. When you perform a
> query against an external data source and you want to throw an exception
> when it doesn't return a value, you test for that condition and handle
> it the way you want to. If it's too difficult to do this in XSLT, then
> perhaps that's a sign that there's a more fundamental problem with XSLT.


It isn't fundamental. I am not suggesting anything that a
simple attribute addition couldn't fix, although I do think that the
particular change needs some discussion so that it solves the problem
as fully as possible.

thanks
-I
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To throw or to throw not? Emanuele D'Arrigo Python 6 11-15-2008 04:12 PM
JNI's throw new does not throw an exception yarona@m-sys.com Java 15 09-08-2005 08:36 AM
Why does std::exception constructor specifies it can throw any ? Pierre Rouleau C++ 3 03-04-2005 05:09 PM
Try-catch not working - why does this throw an Exception? Jon Maz ASP .Net 7 10-25-2004 04:55 PM
Throw Exception Vs Throw New Exception Kerri ASP .Net 2 10-27-2003 02:13 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57