Skip to content

Instantly share code, notes, and snippets.

@aurimasv
Created July 13, 2014 20:09
Show Gist options
  • Save aurimasv/8600699f6b195f3606b2 to your computer and use it in GitHub Desktop.
Save aurimasv/8600699f6b195f3606b2 to your computer and use it in GitHub Desktop.
CSL overlay proposal
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0">
<info>
<title>Some child style</title>
<id>http://www.zotero.org/styles/child-style</id>
<link href="http://www.zotero.org/styles/child-style" rel="self"/>
<link href="http://www.zotero.org/styles/parent-style" rel="template"/>
<updated>2014-07-09T21:58:08+00:00</updated>
</info>
<overlay> <!-- if this is present, the "template" style is loaded, the /style/info node is replaced with above, and the included modifications are performed -->
<select xpath="/style/layout"> <!-- selects as the reference node. Can nest these. Optional -->
<insert xpath="." position="first-child"> <!-- could be before, after (default), first-child, last-child -->
<text variable="title"/>
</insert>
<delete xpath="./text[@variable='title']"/>
<modify xpath="./group[1]"> <!-- replaces contents of the node -->
<text macro="title"/>
<text macro="issued"/>
</modify>
</select>
<insert-attribute xpath="/style/macro[@name='issued']/group" attribute="suffix" value="."/>
<delete-attribute xpath="/style" attribute="demote-non-dropping-particle"/> <!-- note that you can effectively replace everything about the style, but <info> is replaced by this style's info anyway -->
<modify-attribute xpath="//locale[xml:lang='en']//term[@name='editor']" attribute="form" value="verb"/> <!-- shortcut for delete then insert -->
<!-- note that namespaces for xpaths are supplied from the namespace declarations in the <style> element. Which means that "xml" should be declared -->
</overlay>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment