[XSL-LIST Mailing List Archive Home]
>>Another one -- use schema instead of a DTD.
> I don't see, why this would change anything at XSLT level ?
References to schemas are contained within attributes within the
source XML, so it's possible to get the location of an XML schema for
a particular XML instance with something like:
<xsl:variable name="schema-location" select="/*/@xsi:schemaLocation" />
Given that, you can access the schema itself with the document()
<xsl:variable name="schema" select="document($schema-location, /)" />
Once you have hold of the XML Schema, you can theoretically find
information about the document type, such as default attribute values,
by querying into it 'by hand' from within the stylesheet. I think
this is what Dimitre was suggesting.
Given the complexity of XML Schemas and the number of ways you can
express a particular constraint, using information from XML Schemas in
this way is pretty complex. If you have control over the schema, you
can make various simplifying assumptions that might make it
worthwhile. However, I don't think it's possible to reliably gather
the name of the document element (which is what you were after) from a
schema, given that a schema might allow multiple possible document
elements: it's much better to use the XPath 'local-name(/*)' for a
particular instance as various others suggested.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
- RE: doctype, (continued)
- Dimitre Novatchev - Fri, 24 Nov 2000 08:39:25 -0800 (PST)
- Oliver Becker - Fri, 24 Nov 2000 19:53:11 +0100 (MET)
- STENZEL - Mon, 27 Nov 2000 10:45:40 +0100
- Jeni Tennison - Tue, 28 Nov 2000 14:53:26 +0000 <=
- STENZEL - Mon, 27 Nov 2000 11:00:10 +0100
- STENZEL - Mon, 27 Nov 2000 17:15:05 +0100