[MLZ] Possible error with csl-m-validator

The following code triggers an error in csl-m-validator, and yet it runs flawlessly in an actual CSL-m.


<names variable="authority">
<name/>
<institution institution-parts="long-short">
<institution-part if-short="true" name="short" prefix=" (" suffix=")"/>
</institution>
</names>
  • the csl-m validator doesn't allow spaces in affixes.
  • I think prefixes don't allow trailing space and suffixes leading space.
    More importantly, this code causes an error only with the validator, not with MLZ itself. Below is the error I incur.
    stdin:413:8: error: attribute ^name with invalid value "short"
    required:
    value ^token "long"

    error: invalid input
  • Now I understand that not all styles that work validate. So this may or may not be an issue to be addressed.
  • Spaces can be set in a delimiter. If coded that way, a style is more robust. That's why the schema does not allow spaces on the affixes.
  • Now I understand that not all styles that work validate. So this may or may not be an issue to be addressed.
    It's rather common in software that some things work, even when a standard (CSL-m, in this case) is not followed to the letter. An well-known example is HTML, where browsers are often quite forgiving when dealing with invalid HTML. But that something works should not be taken as a sign that it was designed that way. The CSL and CSL-m specifications, and the CSL-m validator, help you stay within the design of CSL-m. We don't offer support for non-validating styles, and non-validating features could easily break in the future.
  • @fbennett,
    It's not the space in this case. Get rid of the space to make it prefix="(" and you still get the error.
  • edited February 11, 2014
    Sorry, I did not read the error message carefully.

    This is documented in the specification supplement. On a cs:institution-part element, you can use name="long" or name="short". To set formatting separately for the long and the short forms, you can set two cs:institution-part elements in the cs:institution node.

    The if-short="true" setting is available only with name="long". When set, formatting is applied to the long form only if a short form is also available. This is a narrowly specialized requirement: there is an example use case in the specification.
  • Yes, I've read the specification supplement, but that part was a little hard to decipher.

    I wanted to write a code to produce a citation format like Example 4 in the supplement. The above was what I came up with, which triggers an error in the validator but does the job.
  • edited February 11, 2014
    This should work for that:
    <names variable="authority">
    <name/>
    <institution institution-parts="long-short">
    <institution-part name="long"/>
    <institution-part name="short" prefix=" (" suffix=")"/>
    </institution>
    </names>

    This will show a validation error on the prefix space, but it should not, since you really do need the space here. I'll adjust the validator soon. You don't need if-short for this one.
Sign In or Register to comment.