qiuwei / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
1 stars 1 forks source link

XSD conversion issue with attribute-based patterns #75

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Conversion to XSD does not work reliably where you have an element whose
content is conditioned on an attribute, or attribute value. For example:

element foo { options }

options = option1 | option2

option1 = element bar { attribute x {"1"}, attribute y {"1"} }

option2 = element bar { attribute x {"2"}, attribute y {"2"} }

I realize XSD cannot really represent this, but I would expect the
resulting schema to allow "1" or "2" as valid attribute values on that
element, and so to be looser than the RNG (rather than stricter, as it is now).

Original issue reported on code.google.com by bdar...@gmail.com on 10 Apr 2009 at 4:20

GoogleCodeExporter commented 8 years ago
When I run your example (after adding start = at the beginning) I get something 
that
violates the XSD Element Declarations Consistent constraint, but is otherwise an
accurate translation of the RNG.  It is a documented limitation of Trang that it
cannot automatically fix up your schema to meet this constraint.

Try writing your schema like this:

start = element foo { options }

options = element bar { option1 | option2 }

option1 = attribute x {"1"}, attribute y {"1"}

option2 = attribute x {"2"}, attribute y {"2"}

Original comment by jjc.jclark.com on 10 Apr 2009 at 8:51

GoogleCodeExporter commented 8 years ago
OK, that works. Thanks; sorry for the noise.

Original comment by bdar...@gmail.com on 10 Apr 2009 at 1:05

GoogleCodeExporter commented 8 years ago
James: one other thing, but am not sure it's a bug or not. This is the actual 
schema:

http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/csl/schema/trunk/csl.rnc?view=
markup

With the changes you suggested, I get a much more useful result. But there's one
little thing: Trang does not pick up that the xml:lang attribute on the 
"info-text"
pattern is optional. Shouldn't it?

Original comment by bdar...@gmail.com on 10 Apr 2009 at 1:16