is-numeric

Hello,

I encounter a problem with the use of "is-numeric".

I naively thought that only numerals would be considered as numeric. I had the bad surprise to discover that it was far larger than that, and not easy to understand.

By example, an issue, entered as "14 - Du Dialogue", becomes "n° 14". The non-numeric part is lost.

For edition, volume, issue, it is very common to use mixed fields.

I would need a test on "strictly numeric".

If the field is "strictly numeric", we want to add a fixed prefix or suffix, if not strictly numeric, we want to take it as it is.

Is there any information on the "is-numeric" rules, and is there a hope for a "strictly numeric" test function ?

Thanks for clarifying it
  • Try putting (English-style) quotation marks around the content of the field and see if that helps.
  • Fine, the result is perfect.

    Thanks for your help
  • Hello!

    I hoped to use this method to allow entering "à paraître" (to be published) in the date field.

    I wrote:

    <if variable="issued">
    <choose>
    <if is-numeric="issued">
    <date variable="issued">
    <date-part name="month" suffix=" " text-case="lowercase"/>
    <date-part name="year"/>
    </date>
    </if>
    <else>
    <text variable="issued">
    </else>
    </choose>

    but the validator refused it.

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

    Is there any method to retrieve non numeric data from the date field ?

    If there was any, I would also use it for entering date-ranges (putting quotation-marks)

    Thanks for your assistance
  • Generally speaking, it's not a good idea to rely on things like this (quote escaping a field) for complex formatting, since other CSL processors (including the one that will be in Zotero 2.1) might handle them differently, thus breaking your style. It also prevents Zotero from reformatting the date in any way, which will be a problem for you later, even if it isn't one immediately now.

    CSL 1.0 will be able to handle date ranges natively, so if you can wait until then, this will be covered, without any need for special treatment. CSL 1.0 will also support a "status" variable, so that (if Zotero supports it) to-be-published works can be flagged as such, and formatted accordingly.

    Neither of these features is in Zotero 2.0. If you are able to find solutions, please remember that thngs will be different (and better) when Zotero 2.1 arrives.
  • Thanks for your response

    I agree with not using non standard ways, but, since it is impossible to imagine all the potential situations, I think any system should provide a standard way to manage non-standard operations.

    SIncerely
  • Now that 2.1 has arrived, the "is-numeric" doesn't seem to have changed.

    I still don't know how to manage with mixed fields that contain at least one number.

    For example "tome XII-2" is considered as numeric, while "tome XII" is not.

    Even if I put it between english quotes, the result is the same.

    Any solution to distinguish numeric and mixed would be welcomed

    Thanks
  • What exactly is the formatting problem you are faced with?
  • The point is, when there is a numeric value in the volume field (idem with issue), we want to have the labeI "vol.", but when the content is not numeric, it has to be displayed as it has been entered.

    For the moment, if it is a mixed field as in the example above
    tome XII-2

    whatever it has been placed between english quotes or not, it is displayed:
    vol. tome XXII-2

    instead of:
    tome XXII-2

    That's what I wrote:

    <macro name="volume">
    <choose>
    <if is-numeric="volume">
    <text term="volume" form="short" suffix=". "/>
    <text variable="volume"/>
    </if>
    <else>
    <text variable="volume"/>
    </else>
    </choose>
    </macro>
  • @l2lafitte,

    Your code is fine, and quoted escaping should work here; it was failing because of a bug in the detection of the quote marks.

    I've applied a fix, but unfortunately didn't make it in time for the Zotero 2.1.7 release. If you need this in the short term, you'll need to use the branch XPI (after the processor revision, 1.0.177, makes it into the Zotero 2.1 branch).
  • Thanks. I will follow your advice

    Anyway, I am happy 2.1.7 is now available
Sign In or Register to comment.