RE: Fixed attribute problems on change from DTD to sch
Thank you Ken; it's a bit inconvenient (having assumed the wrong outcome to begin with) but if I can't work around it easily I can feel justified asking for approval to go to the commercial version. Cheers Trevor -----Original Message----- From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] Sent: Tuesday, 29 September 2009 4:08 a.m. To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Fixed attribute problems on change from DTD to schema 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
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