[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: DTD attribute list syntax for referencing content
It looks like you are trying enforce a dynmic constraint, that some piece of data is the same as some other piece of data. You cannot do this with DTDs. You can do it easily using the Schematron schema language, perhaps with something like this: <rule context="object[@source]"> <assert test="@source =text()" >The contents of the source attribute should be the same as the contents of the element.</assert> </rule> (to get a real version, you would probably want to string-normalize the strings.) However, I wonder if you are actually trying to validate--by saying "populate" it sounds like you really want to do some kind of transformation on the document. To do that, use Perl or XSLT. Cheers Rick Jelliffe ±H¥óªÌ: Dan Matthews <dan@g...> I am trying to validate an XML file against a DTD, and enforce an element attribute which contains data from the XML content (i.e. a reference to the XML file content). here's my DTD code so far: <!ELEMENT object (#PCDATA )> <!ATTLIST object source CDATA #FIXED '{@object}'> As you can see, I want to enforce a 'source' attribute for the object element, and populate it with the content from, for example, the object element itself. I just can't get info on referencing non-string info in a #FIXED attribute declaration! Please help - i'm desperate to get this working!!!
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|