connection of data (mods or marc) to xml (apa.xml)

How are the data, coming in mods or marc format (or whatever), connected to xml?
Usually you find the data in xml between tags (<name>Miller</name>). But where do they go in an apa.xml (besides the info block there is no space for data).
And where is the csl.rnc located? Is it part of the browser (which browsers?), does it come with an plugin, has ist to be installed separately or what?
Thanks
harald
  • It isn't entirely clear to me what you are asking.

    Presumably you are asking about citation formatting (and mean apa.csl, rather than apa.xml).

    The Zotero extension (to Firefox) includes a javascript implementation of citeproc. Citeproc takes (1) bibliographic information and (2) a .csl style file to create formatted citations.

    For (1), the Zotero implementation of citeproc uses zotero item objects (stored in your database) directly. Other implementations uses MODS XML and/or other bibliographic files/databases.

    For (2), the CSL style file is an XML document that adheres to the csl.rnc schema (on sourceforge, as part of the xbiblio project). The actual code that zotero uses to follow the instructions for formatting given in a CSL style file are part of zotero in e.g. /chrome/content/zotero/xpcom/csl.js
  • Part 2 is answered. Thank you very much.

    Part1: I mean definitely apa.xml. How then are the 'zotero item objects' connected to apa.xml. In a 'normal' xml one could fill or change the data in the xml (<name>Miller</name>) via javascript (DOM or just replace certain strings (Miller to Smith)). But where are the data, or how can I connect new data to the apa.xml. Is there a way to connect data to an apa.xml, or how is the apa.xml applied to the data?
    I would like to test it with a small javascript (outside of zotero) to understand the procedure.
    Sorry for my ambigues description.
    harald
  • Part1: I mean definitely apa.xml.
    I might be a bit thick, but what do you mean by apa.xml? CSL files are XML files & do have an info block & apa.csl would refer to the American Psychological Association citation style. I can't think of what you might mean by apa.xml.
    But where are the data
    The data on authors, etc. in Zotero are stored in Zotero's SQLite database (mozstorage in Firefox). Each individual reference can be put into a Zotero item object, with various javascript methods to do things like get individual fields.
    I would like to test it with a small javascript (outside of zotero) to understand the procedure.
    To use citeproc outside of zotero you have a few options:
    • Make Zotero item objects and leverage the pre-existing citeproc code as-is
    • Modify the citeproc code in Zotero to accept e.g. MODS.xml instead of just Zotero items (the place to do this is clearly marked in the code)
    • Use a different (non-javascript) implementation of citeproc.
  • @hwitt: I agree with noksagt; what you're asking is not at all clear.
  • (I suspect Harald is clicking on the file on the styles page and going to File, Save As, which currently saves the style as apa.xml by default.)

    Harald: You mean apa.csl.
  • "Content-Disposition: filename=[name].csl" header now added.
  • If I select "Save page as..." in Firefox I now get proposed file names like ama.csl.xml, which probably isn't the aimed-for result.
  • If I select "Save page as..." in Firefox I now get proposed file names like ama.csl.xml, which probably isn't the aimed-for result.
    OK, well, probably not much we can do about that as long as we're serving the default links as text/xml. It works properly in Firefox when you right-click the link and save (even though it actually does a GET request and receives the text/xml MIME type). Once Firefox loads the page, it appends .xml regardless of the suggested filename.

    (For comparison, Safari uses the end of the URL for initial right-click, apa.csl.xml if you do a right-click after previously loading the page, and apa.xml if you load the page, choose Save As, and select XML. IE 7 uses apa.csl for right-click and apa.xml for Save As. Camino gets both right.)

    I suppose we could add explicit download links, but that seems a little excessive. In any case, apa.csl.xml is an improvement over apa.xml. I'll adjust Zotero to import local *.csl.xml files as well as *.csl.
  • OK, sorry, I mean apa.csl. To be quite sure, here are the
    first lines:

    <?xml version="1.0" encoding="UTF-8"?>
    <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" xml:lang="en">
    <info>
    <title>American Medical Association</title>
    <id>http://www.zotero.org/styles/ama</id>;
    <link href="http://www.zotero.org/styles/ama"/>
    <author>

    Later it goes this way:

    <macro name="author-short">
    <names variable="author">
    <name form="short" and="symbol" delimiter=", " initialize-with="."/>
    <substitute>
    <names variable="editor"/>
    <names variable="translator"/>
    <text macro="anon"/>
    </substitute>
    </names>
    </macro>

    Compared to normal xml: <name>Miller</name> (the data is 'miller') my question is: where or how come the data (Name or Author Miller) into that csl/xml file, where there is the 'author' in a macro as a variable and not between tags. I do not want citeproc to do it for me nor zotero, I just want to do it myself in a simple javascript (as I said I would do it in a normal xml with DOM etc.)
    Perhaps my question is too simple but I would like to understand the basic procedure.

    Thanks a lot
    harald
  • edited October 17, 2008
    There's no such thing as "normal XML". XML is just a file format. If it helps, you can think of CSL as similar to XSL. Just as an XSL file is useless without separate data (stored in an XML file) and an XSLT processor, a CSL file is useless without separate data (stored in Zotero or other data files) and a CSL processor. noksagt explains citeproc, the generic name for the CSL processors written in various languages, above. You can't process CSL by hand unless you write your own CSL processor, which is no small task.

    See the XBib site for more (if somewhat outdated) info on CSL.
  • Please refer to my first post and to Bruce's schematic of citeproc (mentally replacing 'XSLT' with a more general implementation (Zotero's uses javascript transformations, for example)).

    The CSL file only provides instructions on how to format a citation. It does not store raw data.

    The raw data that is used in the citation ("Miller", in your example) has nothing to do with CSL. It is part (1) in my previous description and is labeled "BibDB" in the figure. As above, this raw data is stored in a database for Zotero (but other implementations of citeproc use different storage).
  • Thank you very much indeed for your help and your patience.
    I am a bit lost now. Most of the cited texts I have read before, I am afraid I have to read them once more and more carefully. I will study the mentioned codes as well. That will take some time and I will see how far it takes me. Meanwhile I will enjoy the weekend (beautiful automn full of colors).
    harald
Sign In or Register to comment.