Hi Rodolfo,
> As the use of "state" is optional, parsers don't apply the default value when processing a file.
I still don't understand above. I admit I'm not XML schema expert. But I read w3c specs and some other tutorials, I could only see
Processors of the schema should act as if the attribute was specified with the default value if it was absent. If the schema provides a default value, the "use" attribute must be "optional" ("optional" is the default value for "use" in XML schema, so either use="optional" is explicitly declared or not specifying
the "use" attribute)
> The fragments <segment>
and <segment state="initial"> are not equivalent.
So I could not find any specifications or explanation that support your statement above.
-Yoshito
From: <
xliff@lists.oasis-open.org> on behalf of "Rodolfo M. Raya" <
rmraya@maxprograms.com>
Date: Thursday, April 7, 2022 at 7:06 AM
To: "xliff@lists.oasis-open.org" <
xliff@lists.oasis-open.org>
Subject: [EXTERNAL] RE: [xliff] Another spec question - processing requirements for state attribute
Hi Yoshito, The core XML Schema defines "state" attribute like this: <xs:attribute name="state" use="optional" type="xlf:stateType" default="initial"/> where xlf:stateType is an enumeration
with four values. ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Hi Yoshito,
The core XML Schema defines "state" attribute like this:
<xs:attribute name="state" use="optional" type="xlf:stateType" default="initial"/>
where
xlf:stateType is an enumeration with four values.
Your example
<segment>
<source>Foo</source>
<target>Bar</target>
</segment>
is legal.
The fragments <segment>
and <segment state="initial"> are not equivalent. As
the use of "state" is optional, parsers don't apply the default value when processing a file.
So, we are dealing with an XML grammar trick here.
Your concerns would be valid if we were still using DTDs to define the grammars. We are using XML Schema now because DTDs can't express what the specification says.
The Schematron rules shipped with XLIFF 2.0 / 2.1 are broken due to this XML Schema trick. They say that valid XLIFF files have errors because the "state" attribute
is not properly handled.
Regards,
Rodolfo
--
Rodolfo M. Raya
Maxprograms
http://www.maxprograms.com