Convert from 0.8 to 1.0 CSL

Hi, I used the instructions to convert with this online converter: http://www.shell-tools.net/index.php?op=xslt and it does not seem to be working. Few mistakes happen and mess the whole process, anyone may help please? =)

Here is a link to my script:
https://gist.github.com/909948

Here are the mistakes:

/var/tmp/FOOR8MJmB:5: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xE9 0x66 0xE9 0x72
<title>Manuel canadien de la référence juridique 7e éd. CSL0.8 (Note et bibl
^
/var/tmp/FOOR8MJmB:556: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:556: parser error : attributes construct error
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:556: parser error : Couldn't find end of Start Tag text line 556
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:556: parser error : StartTag: invalid element name
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:568: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:568: parser error : attributes construct error
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:568: parser error : Couldn't find end of Start Tag text line 568
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:568: parser error : StartTag: invalid element name
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:591: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:591: parser error : attributes construct error
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:591: parser error : Couldn't find end of Start Tag text line 591
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:591: parser error : StartTag: invalid element name
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:614: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:614: parser error : attributes construct error
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:614: parser error : Couldn't find end of Start Tag text line 614
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:614: parser error : StartTag: invalid element name
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:630: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:630: parser error : attributes construct error
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:630: parser error : Couldn't find end of Start Tag text line 630
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:630: parser error : StartTag: invalid element name
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:646: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:646: parser error : attributes construct error
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:646: parser error : Couldn't find end of Start Tag text line 646
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:646: parser error : StartTag: invalid element name
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:700: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=" <" suffix=">" />
^
/var/tmp/FOOR8MJmB:700: parser error : attributes construct error
<text variable="URL" prefix=" <" suffix=">" />
^
/var/tmp/FOOR8MJmB:700: parser error : Couldn't find end of Start Tag text line 700
<text variable="URL" prefix=" <" suffix=">" />
^
/var/tmp/FOOR8MJmB:700: parser error : StartTag: invalid element name
<text variable="URL" prefix=" <" suffix=">" />
^
/var/tmp/FOOR8MJmB:735: parser error : Unescaped '<' not allowed in attributes values
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:735: parser error : attributes construct error
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:735: parser error : Couldn't find end of Start Tag text line 735
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
/var/tmp/FOOR8MJmB:735: parser error : StartTag: invalid element name
<text variable="URL" prefix=", en ligne : <" suffix=">"/>
^
unable to parse /var/tmp/FOOR8MJmB

Thanks!
  • Read the error messages: they tell you exactly what's wrong.
  • essentially there are two things, though:
    you need to replace all cases of < and > with
    & lt ; and & gt ; (without the spaces).
    That done, there is a problem left with the accented e - there the shell tool is just being picky, but that, too, you'll have to convert to unicode. Here's a list
    http://tlt.its.psu.edu/suggestions/international/bylanguage/french.html
    for the é you'll want to use either & 233# ; or & eacute ; (again without the spaces)
  • Well, thanks a bunch Adamsmith,

    I could not figure why it would not accept < and > as I don't have real programming knowledge, even if it may seems very basic for many of you. =D
    I'll test and come back if something else is wrong. Consider it done. Thanks!
  • See http://en.wikipedia.org/wiki/Character_encodings_in_HTML#XML_character_references

    Characters like "<" and ">" are considered part of the core XML syntax, so you can't use them directly in strings like suffix=">".
  • edited April 8, 2011
    Thanks for your explaination Rintze. =)

    Now, I do still have those problems... I tried with the numeric code or alphabetic code and none of them seems to be recognize by the online converter.


    /var/tmp/FOORvLIcE:5: parser error : Entity 'eacute' not defined
    <title>Manuel canadien de la r& eacute ;f&233#;rence juridique 7e éd. C
    ^
    /var/tmp/FOORvLIcE:5: parser error : xmlParseEntityRef: no name
    <title>Manuel canadien de la r& eacute ;f&233#;rence juridique 7e éd. C
    ^
    /var/tmp/FOORvLIcE:5: parser error : Entity 'eacute' not defined
    <title>Manuel canadien de la r& eacute ;f&233#;rence juridique 7e éd. C
    ^
    /var/tmp/FOORvLIcE:27: parser error : Entity 'agrave' not defined
    <single>& agrave ; la p </single>
    ^
    /var/tmp/FOORvLIcE:307: parser error : Input is not proper UTF-8, indicate encoding !
    Bytes: 0xAB 0x26 0x23 0x78
    <text variable="title" form="short" prefix="« " suffix=" »"
    ^
    /var/tmp/FOORvLIcE:485: parser error : Entity 'eacute' not defined
    <text value="[non publiée]" />
    ^
    /var/tmp/FOORvLIcE:496: parser error : Entity 'eacute' not defined
    <text value="[non publiée]" />
    ^
    unable to parse /var/tmp/FOORvLIcE

    Edit:
    Okay, so I realize we have to put the "#" before the serial number and not after.
    Now again, all "«" and "»" are also not recognize, so I guess I'll have to convert them all.
    -_-
    I'll come back here for the result once it's done.
  • edited April 8, 2011
    All right, I really cannot work with this converter... it's gonna take a day to convert everything the right way.


    He cannot work with: & eacute ; (Without spaces)
    He morph the wrong codes, r & # 233 ;f & # 233 ;rence

    For instance, é is suppose to be 233, but then it produces something else on the output.
    So "référence" becomes "référence"

    All insecable spaces also converted to this Â.
    Edit: the code for insecable spaces is: & # x0A0 ;
    The code for  is: & Acirc ; or with & # 194 ;
    (Without spaces)
    So why does it generate something completely different?

    Any solutions?
  • edited April 8, 2011
    Can you make a new gist? It would help if you could first make sure your style validates against the CSL 0.8.1 schema: http://www.zotero.org/support/dev/creating_citation_styles#validation
  • Well, I actually used this style many times for homeworks, so it should work. However, you are right, when I validate the style against the CSL 0.8.1 schema, it says this:

    1.

    Error: Bad value issue for attribute variable on element label from namespace http://purl.org/net/xbiblio/csl.

    From line 584, column 10; to line 584, column 82

    ↩ <label variable="issue" form="short" prefix=" " suffix="" plural="true"/>↩
    2.

    Error: Bad value issue for attribute variable on element label from namespace http://purl.org/net/xbiblio/csl.

    From line 607, column 10; to line 607, column 82

    ↩ <label variable="issue" form="short" prefix=" " suffix="" plural="true"/>↩

    Here is the new gist: https://gist.github.com/910514

    Thanks a lot! =)
  • We'll need to fix that first. Did those lines give output with Zotero 2.0? The variable attribute on label may only be set to "locator" or "page". And with plural="true", you lose the main advantage of using a label element, namely context dependent pluralization.

    I think that replacing both lines with
    <text term="issue" form="short" prefix=" " plural="true"/>
    might do it, but you'd have to check that.
  • Good, thanks

    Now: The document validates according to the specified schema(s).

    So what's next?
    ^_^
  • edited April 8, 2011
    With those lines changed, the xslt processor tool only tripped over:

    <option name="subsequent-author-substitute" value="———"/>

    Changing those dashes to regular hyphens did the trick. Your converted CSL 1.0 style can be found at:
    https://gist.github.com/910635
  • Validation of the converted style did turn up one small error, see http://validator.nu/?doc=https://gist.github.com/raw/910635/642999ddb322a00215d6840b9c5b21c0d442d212/gistfile1.xml&amp;schema=http://bitbucket.org/bdarcus/csl-schema/raw/855dcc00cba7/csl.rnc&amp;parser=xml&amp;laxtype=yes

    ---
    Error: Attribute text-case not allowed on element date from namespace http://purl.org/net/xbiblio/csl at this point.

    From line 243, column 5; to line 243, column 91

    ued">↩ <date variable="issued" font-weight="normal" font-style="normal" text-case="lowercase">
    ---

    (CSL 1.0 does no longer allow text-case to be set on the date element)
  • Thanks! So nice of you!

    While the style is valid, it is however full of problems due to the conversion.

    For exemple:
    This: référence juridique 7e éd
    Should be like
    That: référence juridique 7e éd

    and...
    This: Chang, Liu, « Background: Rising Appeals to Beijing », English Caixin, Beijing, 2010, en ligne : <http://english.caing.com/2010-10-20/100190629.html>.
    should be like this:
    Chang, Liu, « Background: Rising Appeals to Beijing », English Caixin, Beijing, 2010, en ligne : <http://english.caing.com/2010-10-20/100190629.html>.

    The script before conversion was:
    r& # 233 ; f & # 233 ; rence juridique 7e & # 233 ;d (Without spaces of course)
    Now it is:
    référence juridique 7e éd

    So I guess I'll start modifying those mis-convertion everywhere... there must be 56 "Â" which should be an unbreakable space.

    Any recommandation? =D
    (Alt-F I suppose)
  • yeah, use search and replace.
    I'm pretty sure that's a problem of the online version of the converter - I don't know if there are alternatives we can point to, I believe that the offline converters don't have that issue.
  • Okay right, well thanks for all of your help, was greatly appreciate. Would have been trying to fix things alone a whole day otherwise. Your help, adamsmith and Rintze, saved me precious time. =)
  • Saxon.jar gives this: https://gist.github.com/910751
  • Cool, I've also added all the 56 unbreakable spaces before ":" and after "page".
    Those are made with
    & # x0A0 ;

    We may now appreciate a new Style, used by a few Universities, regional, provincial and Supreme Courts and Academic Journals in Law all accross the country (Canada).
    ^_^

    Now I gotta get this on the repository... I'll try to understand the procedure.
  • http://www.zotero.org/support/dev/submitting_citation_styles
  • Thanks again, I'll start calling you... dad or mom, which ever you prefer. =)

    I guess I imported it (with Tortoise) so it should eventually appear after someone update the repository. I'm so excited. haha
  • Rintze will do just fine :)
  • Hehe, right!

    Do you know when it might be visible on the http://www.zotero.org/styles page?
    I'll have to spread out the link quite soon for students and teachers. =)

    https://www.zotero.org/svn/csl/mcrj7csl10.csl

    Thanks
  • edited April 13, 2011
    I'm just guessing here, but it might be that the empty links in your style prevent it from showing up in the repository. Try changing:

    <id>www.zotero.org/styles/mcrj7csl08</id>
    <link href="" rel="self"/>
    <link href="" rel="documentation"/>

    to
    <id>http://www.zotero.org/styles/mcrj7csl10</id>
    <link href="http://www.zotero.org/styles/mcrj7csl10" rel="self"/>
  • Done, thanks! =)
  • edited May 11, 2011
    Hello,
    Due to an update to Firefox 4, I had to update to Zotero 2.1.6. I then discovered that the custom style I created was not functional anymore. Since it was not clean at all, I knew I will have to rewrite it from the beginning instead of modifying a style created by the Simple style generator some day. I think this day has come since I now have some leisure.

    I wonder what the following error actually means since I only use normal or Italic :

    Error parsing style:

    CSL processor error, @font-style attribute: TypeError: CSL.Attributes[key] is undefined

    Could you please also tell where to find a list of changes between CSL 0.81 and 1.0. I indeed would like to make the most of CSL 1.0 ? Do you think the primer on 1.0 contains enough details on new features ?

    Edit : I just found the upgrade note.
  • You'll want to start with validation. There is some info here.
  • Thanks very much for your quick reply. I however think I will rewrite the style before validating it.
  • Dear adamsmith,

    could you help me to convert my 0.8 style into an 1.0 style? Tried it by myself but did not work.

    Greetings!
  • https://gist.github.com/1201647

    This is the link to the style. Thanks a lot for your help!
  • download updated style from here:
    https://gist.github.com/raw/1201723/77237eccabf7fdb39a46063505adb1d31a8f9907/heidelberg-medizin.csl

    no guarantees it works like the old one, there is a bunch of strange stuff going on that I can't guarantee the new processor will interpret the same way as the old one.
Sign In or Register to comment.