Results 1 to 2 of 2

Thread: XML with default numeric value in DTD

Threaded View

  1. #1

    Thread Starter
    Lively Member Spetnik's Avatar
    Join Date
    Jan 2002
    Posts
    121

    Arrow 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width