- From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
- Date: Mon, 27 Apr 2009 10:06:53 -0600
- To: Andrew Welch <andrew.j.welch@gmail.com>
- Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, Michael Kay <mike@saxonica.com>, "Costello, Roger L." <costello@mitre.org>, xmlschema-dev@w3.org
On 27 Apr 2009, at 08:48 , Andrew Welch wrote: >> The current draft of XSD 1.1 says that the set of available >> documents is >> empty, which is another way of saying that you can't usefully use >> the doc() >> function in an assertion. > > Ahh that's a shame - I thought it was a great idea. You could publish > an xsd, and then have non-technical people maintain the allowed values > over time. You can still do that. Just use SML, which is designed for validation of sets of documents, with particular emphasis on inter-document references, rather than of single documents in isolation. If you really need to handle such a scenario with XSD, you could manage three documents: (a) the document with the references (call it doc.xml), managed by whoever (b) the country file (countries.xml), managed by the non-technical people you mention (c) a driver file which takes doc.xml and countries.xml and makes a single document out of them for purposes of validation: <temp-doc xmlns:xi="http://www.w3.org/2001/XInclude"> <validation-payload> <xi:include href=".../doc.xml"/> </validation-payload> <controlled-vocabularies> <xi:include href=".../countries.xml"/> </controlled-vocabularies> </temp-doc> Maintain using (a) and (b), validate using (c). Or alternatively maintain a transform for the countries.xml file which reads countries.xml and generates a schema document countries.xsd which contains the enumeration of country names: <xsl:template match="/"> <xsd:schema targetNamespace="mycountrytisofthee"> <xsd:simpleType name="countrycode"> <xsd:restriction base="xsd:string"> <xsl:apply-templates select="//country"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> </xsl:template> <xsl:template match="country"> <xsd:enumeration value="{.}"/> </xsl:template> and regenerate countries.xsd whenever countries.xml changes. Then Roger's original declaration becomes <element name="country" type="tns:countrycode"/> (This is not QUITE the same as Roger's original: his code uses implicit existential quantifiers in the XPath to allow multiple 'country' elements in countries.xml to have the same value. If that's important, then the sketches I've given above would need to be modified; if it's simply an inadvertent error on his part, then the sketches above may be improvements.) -- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net ****************************************************************
Received on Monday, 27 April 2009 16:21:17 UTC