|
-
Nov 19th, 2008, 10:51 AM
#1
Thread Starter
Lively Member
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">
Last edited by Spetnik; Nov 19th, 2008 at 05:28 PM.
-
Nov 23rd, 2008, 08:23 AM
#2
Thread Starter
Lively Member
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|