XML with default numeric value in DTD
I am doing an XML transformation and I have a DTD for the XML with a default value of "0" set for the "cost" attribute of the "expense" element:
Code:
<!ELEMENT expense EMPTY>
<!ATTLIST expense recurrence (One-Time|Monthly|Annual) #IMPLIED>
<!ATTLIST expense name CDATA #REQUIRED>
<!ATTLIST expense cost CDATA "0">
However, when my xml has an "expense" element without a "cost" attribute, I have a problem with the XSL transformation (when I do a select on the cost attribute): IE displays the cost as zero, but Firefox and Chrome leave it blank (or NaN if I run a numeric function on the value). What can I do so that my transformation will show "expense" elements with no "cost" attribute as the correct default value?
Could it be a problem with the headers in my xml file? Here they are:
Code:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="budget.xsl"?>
<!DOCTYPE budgetlist SYSTEM "budget.dtd">
Re: XML with default numeric value in DTD
Well, my DTD is fine, because when I embed it in the file it works.
So the question is, why don't Firefox and Chrome process my DTD when I link it in another file?