This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Populate attribute values?


> Is it possible to populate an attribute value with a                      
> file which contains a list of n values?  What I want to do
> is have the person authoring the document [...] enter a value
> [...] as an enumerated list from an extensive list
> [...]
> I think the best method would be to use an Entity.

This does not seem to have anything to do with XSL.
You should post to comp.text.xml or the xml-dev list.

> DTD
> 
> <!ENTITY % trigraph"
> attribute (AAA|AAB|AAC|AAD|AAE|AAF|...  
>         ZZW|ZZX|ZZY|ZZZ)    #REQUIRED ">
>         
> XML     
> 
> <!ELEMENT para (title|text)*>
> <!ATTRIBUTE para
>               %trigraph >

You titled that section 'XML', but it's just more of your DTD.

A parameter entity is just saving you some typing. You create
the entity -- either an external file or a quoted text string
right in your DTD -- and then give it a name. Then you can refer
to the entity by name. You can't refer to subsets of information
in the entity.

There are also limitations on the use of parameter entities and
I'm not sure your posted example would actually work. Also note
that in the DTD example above, you are:
 1. enumerating a list of values that the attribute *can* have;
 2. constraining the value to be *one* of the items in the list;
 3. constraining each item to be a NMTOKEN

If #2 and #3 are acceptable, you can accomplish #1 using an
external file, but not without the use of entities. By
definition, an external file *is* an entity, whether you declare
it or not. You would put the text (AAA|AAB|AAC|...) in a file,
and then reference it as the replacement text for the parameter
entity like this:

<!ENTITY % trigraphValues SYSTEM "externalFile.txt">
<!ELEMENT para (title|text)*>
<!ATTLIST para
	trigraph %trigraphValues; #REQUIRED>

If #2 and #3 are not what you want, a DTD just isn't going to do
the job.

Follow-ups to the appropriate forum, please.


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]