CSL question: text replacement

In CSL, in it possible to replace variable values as follows?

(1) Remove spaces:

Some variable value -> Somevariablevalue

(2) Replace spaces:

Some variable value -> Some_variable_value

(3) Create abbreviations:

Some variable value -> Svv

(Perhaps as a parameter for 'text-transform'?)
Many thanks!
  • edited July 29, 2018
    No, it is not possible for CSL to replace text values like that (the only thing that can be removed are periods with strip-periods="true"). You can, however, call the "short" form of title variables in CSL and store these "short" forms in the Extra field in Zotero:
    Title Short: SVV
    Container Title Short: SVV
    Collection Title Short: SVV

    Juris-M (https://juris-m.github.io), a third-party version of Zotero with expanded legal and multilingual capabilities, also includes a powerful Abbreviations Filter that can do this sort of on-the-fly content-based text replacement.

    ('text-transform' is only used to change the casing (capitalization) of text.)
  • Many thanks!

    How would I be able to apply this selectively? Ideally, I would only like to use 'title short' if there are no authors (hence e.g. institution is used) AND the institution has spaces. I suppose the right strategy would be to use the 'title short' (if present) in preference to 'institution'. Is that correct?
  • edited July 29, 2018
    (EDIT: Ah - we need "-", then it works!)

    In the CSL, I'm inserting text variable="collection-title-short":

    <choose>
    <if type="report">
    <text variable="collection-title-short"/>
    <text variable="publisher"/>
    <text variable="title" form="short" font-style="italic"/>
    </if>

    It has the effect of removing the publisher, but nothing is printed instead. So it seems like the field is there, but empty.

    Also, it seems to then suppress the title field, presumably because the 'short title' has been used?

This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.

Sign In or Register to comment.