|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








