|
Subject: Re: [xsl] Schema and fixed attribute value From: "Bruno Chatel" <bcha@xxxxxxxxxxx> Date: Wed, 17 Jul 2002 23:11:12 +0200 |
Hi Jenni,
thanks for this answer :-)
> > I tried to load the unit.xml as a DOMSource by using Xerces2.0.2 parser
> > with features like
> >
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
> > parser.setFeature("http://apache.org/xml/features/validation/schema",true);
> > parser.setFeature("http://xml.org/sax/features/namespaces", true);
> >
parser.setFeature("http://apache.org/xml/features/validation/schema/normalized-value",true
> > );
> >
parser.setFeature("http://apache.org/xml/features/validation/schema/element-default",true)
> > ;
> >
> > but the attribute value seems to be not accessible in my stylesheet.
>
> 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).
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..) ?
> The Xerces documentation suggests that the normalized-value and
> element-default features only work if validation occurs, which implies
> that the same might be true for fixed/default attribute values as
> specified in XML Schema.
>
> If that doesn't work, I suggest that you ask on the
> xerces-j-user@xxxxxxxxxxxxxx mailing list.
I ask on xalan-j-user list..
> If all else fails, you might be able to access the schema from XSLT in
> order to work out what the fixed value of the attribute is. However,
> processing XML Schemas with XSLT is not trivial (unless you constrain
> the schemas), so if you can fix the DOM that you're passing to Xalan
> that will be the best option.
Yes.. It is my last solution if I can not get default values.. But I hope that I will
not need to do this !!!
-- bruno --
Bruno Chatel
Tel : (+33)[0] 4 96 11 14 57
Email : bcha@xxxxxxxxxxx
http://www.chadocs.com
----------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Schema and fixed attribut, Jeni Tennison | Thread | Re: [xsl] Schema and fixed attribut, Jeni Tennison |
| [xsl] plain text output, Guy McArthur | Date | Re: [xsl] Schema and fixed attribut, Jeni Tennison |
| Month |