RE: [xsl] Using attributes and elements and text

Subject: RE: [xsl] Using attributes and elements and text
From: JBryant@xxxxxxxxx
Date: Thu, 24 Feb 2005 12:32:13 -0600
I found this comment (from Michael Sperberg-McQueen's 1992 entry) to be 
the most cogent: "it wasn't such a fateful decision after all, but one you 
could back out of later if you really needed to."

Given that we can write stylesheets to turn <book 
title="something">...</book> into <book><title>something</title>...</book> 
and back again, it's not that big a deal to me.

That said, I have my rules of thumb, as I'm sure we all do. Mine go like 
this:

* If it can't be repeated, is just text, and is fairly short, make it an 
attribute. Thus, I tend to make title into an attribute.

* If it can be repeated, has its own structure (such as a title that has a 
subtitle), or is more than a few words, make it an element.

FWIW

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)





"Michael Kay" <mike@xxxxxxxxxxxx> 
02/24/2005 11:45 AM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
<xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
cc

Subject
RE: [xsl] Using attributes and elements and text






> 
> I have never see a conclusive definition on when using attributes
> instead of elements 

The usual reference is

http://xml.coverpages.org/elementsAndAttrs.htm

Michael Kay
http://www.saxonica.com/

Current Thread