Passing #FIXED values through para. entity refrences

Amit Rekhi (amitr@abinfosys.com)
Mon, 29 Jun 1998 16:22:22 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_004E_01BDA37A.185D57B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello All,
I am in the process of BETTERING an XML-DTD I made.

In the process of making it compact, I decided to =
encapsulate all the repeated(in the DTD) attribute definations of =
elements in parameter entities, and use para. entity refrences in places =
where the attr. defs. are repeated.

But, all the repeated attributes I want to add to my =
parameter entity have #FIXED and DIFFERENT values at all the places =
they are repeated at, as a result of which I am not being able to add =
them to the para. entity replacement text even though they are repeated.

Let me explain my problem with an example.

I have the following 2 element declarations :-

<!ELEMENT ele1 (#PCDATA)>
<!ATTLIST ele1=20
common-attr CDATA #FIXED =
"common-attr-value1">

<!ELEMENT ele2 (#PCDATA)>
<!ATTLIST ele2=20
common-attr CDATA #FIXED =
"common-attr-value2">

Since both the elements have AN ALMOST SIMILAR =
attribute 'common-att' (except the #FIXED values) I want to encapsulate =
the common-attr attribute defination in a parameter entity and refrence =
the para. entity at points where I want to add the common-attr =
defination, so that my DTD would loook like :-

< !ENTITY %attr-def 'common-attr CDATA #FIXED =
".................." '> =20

=
|
=
|
=
\ /
=
What to write here =20

<!ELEMENT ele1 (#PCDATA)>
<!ATTLIST %attr-def; >
=20
<!ELEMENT ele2 (#PCDATA)>
<!ATTLIST ele2 %attr-def;>

But the problem of using a parameter refrence here is that the attribute =
'common-attr' has different #FIXED values at both the places it is =
used so a simple refrence like %attr-def; will not give it the required =
#FIXED values it requires.

Concerning this issue I have 3 questions :-

1. Whether encapsulating the attribute common-attr in a para. refrence =
is proper or not even though the attribute is NOT exactly similar in =
both places it is used?

(I feel it is correct,since the attribute definations at both the places =
differ only in their VALUE , nothing else!)

2. Is there way to pass #FIXED values of SAME parameter definations =
through their entity refrences(something like parameter passing)? eg.=20

<!ELEMENT ele1 (#PCDATA)>
<!ATTLIST ele1 %attr-def(/*-------pass fixed value =
here--------*/); >
=20
<!ELEMENT ele2 (#PCDATA)>
<!ATTLIST ele2 %attr-def(/*-------pass fixed value =
here--------*/);>

3. Is there any way I can add attributes like 'common-attr'(used in the =
eg. above) to a para. entity and only call its refrence in places it is =
needed in the DTD making sure that at each calling place a unique #FIXED =
value is passed?

Thanx in advance,

=
AMIT REKHI
=
Software Engineer,
=
A.B.Infosys.P.Ltd,
=
New Delhi=20
=
INDIA.
=20

------=_NextPart_000_004E_01BDA37A.185D57B0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">

Hello = All,
          &nbs= p;    =20 I am in the process of BETTERING  an XML-DTD I=20 made.
 
          &nbs= p;    =20 In the process of making it compact, I decided to encapsulate all the=20 repeated(in the DTD) attribute definations of elements in parameter = entities,=20 and use para. entity refrences in places where the attr. defs. are=20 repeated.
 
          &nbs= p;    =20 But, all the repeated attributes I want to add to my parameter = entity =20 have  #FIXED and DIFFERENT values at all the places they are = repeated=20 at,  as a result of which I am not being able to add them to the = para.=20 entity replacement text even though they are = repeated.
 
          &nbs= p;    =20 Let me explain  my problem with an=20 example.
 
          &nbs= p;    =20 I have the following 2 element declarations = :-
 
          &nbs= p;    =20 <!ELEMENT ele1 (#PCDATA)>
         &nb= sp;     =20 <!ATTLIST ele1
          &nbs= p;            = ;            =         =20 common-attr CDATA #FIXED = "common-attr-value1">
 
          &nbs= p;    =20 <!ELEMENT ele2 (#PCDATA)>
         &nb= sp;     =20 <!ATTLIST ele2
          &nbs= p;            = ;            =         =20 common-attr CDATA #FIXED=20 "common-attr-value2">
 
 
          &nbs= p;       =20 Since both the elements have AN ALMOST SIMILAR attribute=20 'common-att' (except the #FIXED values) I want to encapsulate the = common-attr=20 attribute defination in a parameter entity and refrence the para. entity = at=20 points where I want to add the common-attr defination, so that my DTD = would=20 loook like :-
 
          &nbs= p;   =20 < !ENTITY %attr-def  'common-attr CDATA #FIXED=20 ".................."=20 '>          &= nbsp;      =20
 
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =    =20 |
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =    =20 |
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =   =20 \ /
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;        =20 What to write here      
 
          &nbs= p;    =20 <!ELEMENT ele1 (#PCDATA)>
         &nb= sp;     =20 <!ATTLIST %attr-def; >
 
          &nbs= p;    =20 <!ELEMENT ele2 (#PCDATA)>
         &nb= sp;     =20 <!ATTLIST ele2 %attr-def;>
 
But the problem of using a parameter refrence here is that the = attribute=20 'common-attr'  has different  #FIXED values at both the places = it is=20 used so a simple refrence like %attr-def; will not give it the required = #FIXED=20 values it requires.
 
Concerning this issue I have 3 questions :-
 
1.  Whether encapsulating the attribute common-attr in a para. = refrence is=20 proper or not even though the attribute is NOT exactly similar in both = places it=20 is used?
 
(I feel it is = correct,since the=20 attribute definations at both the places differ only in their VALUE , = nothing=20 else!)
 
2. Is there way to pass #FIXED values of SAME parameter definations = through=20 their entity refrences(something like parameter passing)? eg.
 
          &nbs= p;    =20 <!ELEMENT ele1 (#PCDATA)>
         &nb= sp;     =20 <!ATTLIST  ele1 %attr-def(/*-------pass fixed = value=20 here--------*/); >
 
          &nbs= p;    =20 <!ELEMENT ele2 (#PCDATA)>
         &nb= sp;     =20 <!ATTLIST ele2 %attr-def(/*-------pass fixed value=20 here--------*/);>
 
3. Is there any way I can add attributes like 'common-attr'(used in = the eg.=20 above) to a para. entity and only call its refrence in places it is = needed in=20 the DTD making sure that at each calling place a unique #FIXED value is=20 passed?
 
          &nbs= p;        =20 Thanx in advance,
 
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =            =20 AMIT REKHI
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =   =20 Software Engineer,
         &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;    =20 A.B.Infosys.P.Ltd,
         &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;    =20 New Delhi
          &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =    =20 INDIA.
 
------=_NextPart_000_004E_01BDA37A.185D57B0-- xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@ic.ac.uk the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)