Testing xs:assert in Saxon SA at the command line I couldn't help but notice how nice it would be if we could have user-defined error messages. Why not allow something like the following:
<xs:assert test="some checksum validation of ISBN number">
<xs:annotation>
<xs:appinfo>
<saxon:error>Your number is not a valid ISBN number</saxon:error>
</xs:appinfo>
</xs:annotation>
</xs:assert>
It would be even better if something similar could get into the spec, let us say:
<xs:appinfo>
<xs:error>Your number is not a valid ISBN number.</xs:error>
</xs:appinfo>
Bu why not implement such an option in Saxon to show the way?
Cheers,
Jesper Tverskov
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is in fact some push behind getting something like this into the spec, and I was waiting to see what came of it before doing my own thing. To be honest, I would like to do more than a simple fixed error message. I would like to see something like
<xs:assert test="some checksum validation of ISBN number"> <xs:annotation>
<xs:appinfo>
<saxon:error>Book {./title} has an invalid ISBN number {./@isbn}</saxon:error>
</xs:appinfo>
</xs:annotation>
</xs:assert>
Also, I don't think that assertions, just because of their Schematron heritage, should necessarily get special treatment here - I think the same facilities are needed for other error conditions, such as not satisfying a pattern or an enumeration.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Testing xs:assert in Saxon SA at the command line I couldn't help but notice how nice it would be if we could have user-defined error messages. Why not allow something like the following:
<xs:assert test="some checksum validation of ISBN number">
<xs:annotation>
<xs:appinfo>
<saxon:error>Your number is not a valid ISBN number</saxon:error>
</xs:appinfo>
</xs:annotation>
</xs:assert>
It would be even better if something similar could get into the spec, let us say:
<xs:appinfo>
<xs:error>Your number is not a valid ISBN number.</xs:error>
</xs:appinfo>
Bu why not implement such an option in Saxon to show the way?
Cheers,
Jesper Tverskov
There is in fact some push behind getting something like this into the spec, and I was waiting to see what came of it before doing my own thing. To be honest, I would like to do more than a simple fixed error message. I would like to see something like
<xs:assert test="some checksum validation of ISBN number"> <xs:annotation>
<xs:appinfo>
<saxon:error>Book {./title} has an invalid ISBN number {./@isbn}</saxon:error>
</xs:appinfo>
</xs:annotation>
</xs:assert>
Also, I don't think that assertions, just because of their Schematron heritage, should necessarily get special treatment here - I think the same facilities are needed for other error conditions, such as not satisfying a pattern or an enumeration.