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

Re: Inheritance/defaulting of attributes

  • From: "Rick Jelliffe" <ricko@a...>
  • To: <xml-dev@i...>
  • Date: Sun, 5 Oct 1997 16:19:15 +1000

attribute cdata
 
> From: Peter Murray-Rust <peter@u...>

> This requires the implementation to provide for LOCATORs (children) to
> 'inherit' attributes from EXTENDED (parent). In my own DTD I would like to
> be able to use this philosophy, as in the following simple example of a
> list of numbers, all of type FLOAT

> Is this seen as a sufficiently general mechanism in XML that it is worth
> creating a DTD-independent engine for this? If so, is there a general
> mechanism for indicating (in the document instance or DTD) that this
> operation is to be carried out? At present it is only prose in the XLL
> spec?  It might be preferable to have a syntactic stement of this
> requirement - do otehrs feel the same? Can AFs be used? 

In your particular example, it can already be done using XLL, with only
a small change in the invocation syntax.

The VAR elements have a link to the first conatining parent element
with a role "datatype".  The LIST element has an XLL href (remapped to 
the name "type") that links to the approporiate type element.
The TYPES container has empty elements for all the different types
you care to make.  An example of these is the float type, which 
in turn has a pointer to some defining documentation.

Perhaps what you need can best be dealt with by defining some
standard values for the XLL role attribute!  (See the values for
role=  below for candidates.)  I think the standard definition
of some role types (i.e. moving "role" into more certain 
architecture") would be highly useful--if no common values are 
defined, role will go the way of PIs and languish in unuseability
due to meaninglessness.


<!DOCTYPE example [

<!-- Dummy top level -->
<!ELEMENT example - - ( TYPES, LIST* )>

<!-- Define container for types -->
<!ELEMENT TYPES	- - ( FLOAT, ... )>

<!--  First, define the element type float, and give documentation -->
<!ELEMENT FLOAT	- O EMPTY>
	<!ATTLIST FLOAT
		XML-LINK	CDATA #FIXED "simple"
		href		CDATA #FIXED "float-definition.htm" 
		role		CDATA #FIXED "lexical-type-specifier" 
		id		ID	#FIXED "FLOAT" > 

<!-- Now, define the LIST element type -->
<!ELEMENT LIST	- O  ( VAR* )>
	<!ATTLIST LIST
		XML-LINK	CDATA #FIXED "simple"
		XML-ATTRIBUTE CDATA #FIXED "href type"
		type		CDATA #REQUIRED 
		role		CDATA #FIXED "data-type-selector">

<!-- Define the VAR element type -->
<!ELEMENT VAR	- - (#PCDATA) >
	<!ATTLIST VAR
		XML-LINK	CDATA #FIXED "simple"
		href		CDATA #FIXED "#HERE()ANCESTOR(1, *, role, data-type-selector)"
		role		CDATA #FIXED "link-to-data-type-selector"
		title		CDATA #REQUIRED >

]>

<!-- Here is the instance -->
<example>

  <TYPES><FLOAT/></TYPES>

  <LIST TYPE="#ID(FLOAT)">
   <VAR TITLE="x" >1.2</VAR>
   <VAR TITLE="y">2.3</VAR>
  </LIST>

</example>

 
Rick Jelliffe

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.