Aliases

G

Gus Gassmann

Please forgive the beginner's question. Is it possible to have two
names for the same element? I am thinking of something like
....
<prob>...</prob>

or

<probability>...</probability>

which would be used interchangeably, with the same syntax and
interpretation of the values. (But of course the start and end tags
would match!)

Ideally I would also not duplicate the innards of these elements. Is
this possible? Acceptable? Useful?
If it makes a difference, I am thinking of w3 XML Schema.

Thanks for any ideas

gus gassmann
 
J

Joseph Kesselman

Gus said:
Please forgive the beginner's question. Is it possible to have two
names for the same element?

At the XML level, no; those are two different elements.

Of course your Schema could say that both are acceptable and have the
same content, and your application code could treat them as meaning the
same thing, so this may not be a real limitation.

On the other other hand... Generally, that kind of variability for the
sake of variability is NOT a good thing; it complicates things without
really improving usability. So the answer is "possible in practice,
acceptable but usually not desirable, not particularly useful."
 
J

Joseph Kesselman

Oh -- another solution would be a preprocessing stage (eg an XSLT
stylesheet) which remaps the alias into the single "official" version
before your actual application code starts validating and processing the
document. Again: Possible, but you'd need to have a really good reason
for introducing this complication.
 
J

Johannes Baagoe

[Elements with identical syntax and semantics, but different names]

Joseph Kesselman :
another solution would be a preprocessing stage (eg an XSLT stylesheet)

Would that be an <xsl:stylesheet> or an <xsl:transform> ? ;-)
 
J

Joseph Kesselman

Johannes said:
Would that be an <xsl:stylesheet> or an <xsl:transform> ? ;-)

Sigh. Chalk up one point for JB... <sigh/> I have the impression that
this was a bit of politics over "but if it isn't being used to render
something for viewing, will calling it a stylesheet confuse people"...
and the outcome appears to be, as I suggested, that this bit of extra
flexibility really wasn't necessary after all.
 
J

Johannes Baagoe

Joseph Kesselman :

[ said:
I have the impression that this was a bit of politics over "but if
it isn't being used to render something for viewing, will calling
it a stylesheet confuse people"... and the outcome appears to be,
as I suggested, that this bit of extra flexibility really wasn't
necessary after all.

My impression is that the sightly confusing vocabulary comes from early
days when XSLT and CSS were seen as competing rather than complementary
technologies within the W3C. Those days are over, and since as often as
not, the XSLT I write generates <link> elements to CSS, since most people
associate "stylesheet" with CSS, and since "transform" is both available
and intuitive, I have resolved never to use "stylesheet" for XSLT.

I agree that having two designations for the same concept is more
harmful than helpful. But if one of the two were to be dropped from
some future version of XSLT, I hope it will be "stylesheet". It is quite
hard enough to explain how all that works together without using the same
word for two quite different things, which causes a much greater
difficulty than using two words for the same thing.
 
B

Bjoern Hoehrmann

* Johannes Baagoe wrote in comp.text.xml:
My impression is that the sightly confusing vocabulary comes from early
days when XSLT and CSS were seen as competing rather than complementary
technologies within the W3C.

If you look at http://www.w3.org/TR/1998/WD-xsl-19980818 you'll see that
the transformation and formatting components of "XSL" where much less
separate in the beginning than they are now and the split was less clean
than one could have hoped. XSLT and CSS have never been competing, it's
XSL-FO and CSS (or XSLT and XSL-FO vs CSS if you like) who "did" that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top