Actually it is useful in SOA applications, because there are several platforms (Progress OpenEdge, used by thousands of companies everywhere, for example) that send null fields as xsi:nil elements instead of omitting them, and require xsi:nil elements to be sent when fields are null. When working with these platforms, you might want to check for xsi:nil elements and either remove or transform them to something else.
The fn:nilled function is a better solution than @xsi:nil = 'true', the de facto workaround. Since my last post, I've tried getting it to work with both Saxon-B and Saxon-SA without success, though I may have insisted to use JAXP (DocumentBuilderFactory with Schema and XMLReader with ValidationHandler) for too long. Let me know if I should try the Saxon API instead.
If you want more information about use cases like this, we can talk off-list.
The simplest way of explaining fn:nilled() is that it returns true if two conditions are satisfied:
(a) the element specifies xsi:nil="true"
(b) the element is validated against a schema
To be honest, I don't know of any practical use case for this function. I think that the "nilled" property was needed in the data model to make the formal semantics work, and having got the property in the data model, people felt it ought to be accessible to applications. If you find a good use for it, let me know, because I can't think of one!
Generally xsi:nil is a bit of a disaster anyway. I don't see why you can't represent absent data by omitting the element, rather than having it present with no value.
From: Fernando Ribeiro [mailto:email@example.com]
Sent: 29 January 2009 16:57
Subject: [saxon] Use of fn:nilled
To: Mailing list for the SAXON XSLT and XQuery processor
I've been trying to use the nilled function but it seems like I am missing something about it. I'd appreciate if you could take a look at the attached example and find out why it doesn't work as expected.
Note that there ain't a schema (with nillable=true) attached to the source, as in the actual case (ain't an option) upon which the example is based.
I am currently using 184.108.40.206, which is embedded with the runtime in question.
This SF.net email is sponsored by:
SourceForge wants to tell your story.
saxon-help mailing list archived at http://saxon.markmail.org/