[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: doctype

Subject: Re: doctype
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 28 Nov 2000 14:53:26 +0000
xsl xml schema doctype
Gerhard,

>>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()
function:

<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.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.