Re: [xsl] Schema and fixed attribute value

Subject: Re: [xsl] Schema and fixed attribute value
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 17 Jul 2002 22:35:06 +0100
Hi Bruno,

>> That surprises me. Xerces should be able to add the attribute in the
>> DOM just as if it had been specified in the XML document originally.
>> You might try setting the validation feature to true as well as the
>> ones that you've set above:
>>
>>   parser.setFeature("http://xml.org/sax/features/validation",true);
>
> This feature seems to check the document against a DTD. When setting
> it, I get error message about needed declaration for root element of
> my document (correctly declared in my schema).

Yes, that feature checks the document against the DTD if there is one,
but it's also used to indicate whether the document should be checked
against the schema (see
http://xml.apache.org/xerces2-j/faq-pcfp.html#faq-3). As you're
getting errors, I guess that you have a DOCTYPE declaration, but not a
full DTD. Can you ignore the validity errors and still get the DOM
out?

> But, I am not sure that the problem is here...
> As far as i understand the Xalan processing model, the internal tree
> representation is not (on 2.3.x) a DOM tree (but something called
> DTM).
> I don't know if processing a DOM source (loaded by Xerces) implies that
> Schema properties are kept in internal tree model.
> Any idea about this ?
> Is it the same with other processors (such Saxon, ect..) ?

If you pass a DOM to the XSLT processor, then the processor should
built its internal tree representation by querying that DOM. Fixed
attributes can be added to a DOM tree (so you don't need an API over
and above the DOM to represent them), so you should be able to do:

  XML document --parse--> DOM tree + fixed attributes
               --query--> Xalan's internal tree representation

I don't think that the problem will be in going from the DOM tree
(including the fixed attributes) to the tree used by Xalan; I think
that it'll be in going from the XML document to the DOM tree that
includes the fixed attributes.

Let us know if you find a fix.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread