What is the type of an attribute with a default or fixed value? Is it always string?

Hi Folks,

In section 3.2.2 of the Structures specification it has a box showing this:

    XML Representation Summary: attribute Element Information Item

   <attribute
         default = string
         fixed = string
         ...

I interpret that to mean the type of a default or fixed value is always string. Yes?

Suppose I declare this:

     <attribute name="pi" type="decimal" default="3.14" />

Suppose I use the default value in an XML instance document:

    pi = "3.14"

Since the value is (presumably) a string type, it is nonsensical to perform arithmetic on it in, say, an XSLT program:

     @pi * diameter

And one should expect an error to be thrown. Yes?

Now, suppose I don't use the default value:

    pi = "3.14159"

Since the declared type of pi is decimal, I can perform arithmetic on it:

     @pi * diameter

Yes?

Recap: sometimes pi is a string (and I can't do arithmetic on it) and sometime pi is a decimal (and I can do arithmetic on it). Yes?

/Roger
 

Received on Friday, 20 July 2012 11:19:32 UTC