[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Accessing attribute from DTD


Subject: Re: Accessing attribute from DTD
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: Fri, 8 May 1998 11:56:21 -0400

/ Amit Rekhi <amitr@xxxxxxxxxxxxx> was heard to say:
| I can access the attribute value of a target element in XSL using 
| 
| target-element.getAttribute("attribute-name");
| 
| In such a case, the attribute value for the target-element is picked from
| the XML file.
| 
| But what if the attribute value is specified in the DTD rather than the XML?
| 
| What API do I use to access the attribute value (of a target element)
| specified in the DTD??

There's no specific API for doing this, though there may be an
API eventually that will let you look at the structure of the
DTD for the source instance.

If your XSL processor processes the DTD for the instance,
default attribute values should be propagated onto the actual
target-elements.  (In other words, you shouldn't have to look at
the DTD for attribute values, attributes occur on elements.) If
your XSL processor ignores the DTD (and the element declarations
in the internal subset, if there are any), then you're stuck.
You'll have to normalize the instance before you apply style
with XSL.

This means that you may get dramatically different results with
different XSL processors if you rely on attribute values
defaulted in the DTD and some (but not all! ;-) XSL processors
ignore the DTD.  This is not a good thing.

--norm


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords