please help with style modification

Hejhej!

Starting from this style http://www.zotero.org/styles/angewandte-chemie I would like to introduce a weblink. The style should give the DOI if available or the website.
I tried to put
<choose>
<if variable="DOI">
<text variable="DOI" prefix="direct link: http://dx.doi.org/"/>
</if>
<else>
<text term="direct link: " suffix=" "/>
<text variable="URL"/>
</else>
right before
<citation>
<option name="collapse" value="citation-number"/>
<sort>...
and loaded the style in Zotero (latest stable Firefox, OpenOffice and Zotero addons).
The bibliography didn't change though :-(
Also tried to delete the section
<choose>
<if variable="page" match="none">
<choose>
<if variable="DOI">
<text variable="DOI" prefix="DOI "/>
</if>
</choose>
<choose>
<if type="webpage">
<text variable="URL" prefix="can be found under "/>
</if>
</choose>
</if>
</choose>
which was above my addition, but no results again.

Could anyone give me a tip how to insert this little DOI/URL choise into the style? Thanks!
  • this line:
    <text term="direct link: " suffix=" "/>
    isn't valid (nor is it a good idea to use).
    Remove it and instead add prefix to the URL:
    <text variable="URL" prefix="direct link: "/>

    also, your added section needs a closing </choose>
    Deleting the other section should be fine.
  • Thanks for the tip :-)
    However, I was able to solve the problem by replacing the I delted before (see first post) with:
    <choose>
    <if variable="DOI">
    <text variable="DOI" prefix="direct link: http://dx.doi.org/"/>
    </if>
    <else>
    <if type="webpage">
    <text variable="URL" prefix="direct link: "/>
    </if>
    </else>
    </choose>
    Now the DOI is inserted right after the prefix, so that it becomes a clickable link. I am still trying to get it to 'code' the choise: IF DOI, ELSE URL. Will post my findings, am still grateful for help ;-)
  • I don't understand the "however" - you did what I suggested, no?

    The code above shouldn't work correctly - it misses and <choose> </choose> (for the if type=webpage)
    you might get lucky and have it work but it's not recommended.
    Why do you even need that?

    Could you describe more specifically what you're trying to do?
  • The style I start with doesn't insert DOI or URL into the bibliography. To make it easier for the reader to follow the references, I want to add the following capability to the style:
    - insert the DOI number IF it is in the citation's data
    - ELSE insert URL
    - do nothing if both are inavailable

    Your suggestion about "<text variable="URL" prefix="direct link: "/>" didn't work unfortunately. Yes, I added </choose> ;-)
  • Why not replace<if type="webpage">with<if variable="URL">(or just remove that if block completely if the only line you have there is <text variable="URL" prefix="direct link: "/>because it should fail gracefully).
  • note that if you use noksagt's first suggestions you still need to enclose the <if> </if> by <choose> </choose>

    but I think the second suggestion - taking out the <if type> and </if> entirely makes more sense anyway.
  • OK, this one definitely does what I want:
    <choose>
    <if variable="DOI">
    <text variable="DOI" prefix="direct link: http://dx.doi.org/"/>
    </if> ---> prints the DOI number into a clickable link
    <else>
    <text variable="URL" prefix="direct link: "/>
    </else> ---> prints the URL only if no DOI is available
    </choose>

    If I leave out any IF or ELSE now, both DOI and URL are printed, which makes the citation list a bit fuller than my supervisor accepts ;-D

    the ELSE part can also be replaced with
    <if variable="URL">
    <text variable="URL" prefix="direct link: "/>
    </if>

    OK now: never change a running system (right before handing in your Master thesis) ;-D

    Thanks for your help/Takk for hjelpen :-)
Sign In or Register to comment.