Re: [xsl] Fixed attribute problems on change from DTD to schema

Subject: Re: [xsl] Fixed attribute problems on change from DTD to schema
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Sep 2009 11:08:04 -0400
At 2009-09-29 03:44 +1300, Trevor Nicholls wrote:
As previously described I have switched from DTD modelling to XSD for my
application's XML files. Today I have encountered a problem with
default/fixed attribute values: the fixed attribute value appears to be
forced into the parsed XML file when using the DTD (as wanted) but
apparently not found when using the schema.

Indeed.


Unlike my earlier problems, I am not compelled to use Xalan for this
transformation, and it is (mis)behaving as described

... but behaving as specified ...


when the processor is Saxon:

 * the section in document 1 is matched by the first template;
 * the section in document 2 is matched by the second template.

I would expect both documents to give the same result (and use template 1
for sections).

As I had expected when I first worked with schemas and XSLT 2, but learned quickly is not the case.


Can somebody please explain why this is happening?

Because being aware that an attribute has a default value from a schema requires schema awareness to be turned on. When dealing with Saxon, this involves the use of a commercial license (well worth the money!) rather than the free license.


The commandline is
identical for the two cases, no options are being supplied either to
suppress or to force attribute value inheritance from the DTD/schema.

Right ... but in XSLT 1.0 this was a defined behaviour and has migrated into the XSLT 2.0 specification for DTD processing, while schema awareness is new in XSLT 2.0 and being aware that an attribute has a default value is part of that.


I hope this helps answer your question.

. . . . . . . . . . Ken


-- Upcoming hands-on code list, UBL, XSLT, XQuery and XSL-FO classes. Interested in other classes? http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread