On Tue, Nov 17, 2009 at 3:00 AM, Jochen Lienhard
<lienh...@ub.uni-freiburg.de> wrote:
> Hi,
>
> we plan to implement xmlui templates for different citation systems
> (for example: citavi, zotero, refworks).

I have Context Objects in Spans on mine (works for Zotero import), and
an obtuse but more-or-less functional RefWorks export. I designed both
myself, so I'm not prepared to say they're the world's greatest
quality. If you want them to play with, the former can be found
somewhere in <http://minds.wisconsin.edu/themes/utils.xsl>, and
(apologies for the code dump) the latter is below -- don't forget to
fix the data source.

(Note to self: I should really clean a lot of pointless code out of
utils.xsl one of these fine days...)

Dorothea

-- 
Dorothea Salo                ds...@library.wisc.edu
Digital Repository Librarian      AIM: mindsatuw
University of Wisconsin
Rm 218, Memorial Library
(608) 262-5493

<xsl:stylesheet xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
    xmlns:dri="http://di.tamu.edu/DRI/1.0/";
xmlns:mets="http://www.loc.gov/METS/";
    xmlns:xlink="http://www.w3.org/TR/xlink/";
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="1.0" xmlns:dim="http://www.dspace.org/xmlns/dspace/dim";
    xmlns:xhtml="http://www.w3.org/1999/xhtml";
xmlns:mods="http://www.loc.gov/mods/v3";
    xmlns:dc="http://purl.org/dc/elements/1.1/";
xmlns="http://www.w3.org/1999/xhtml";
    exclude-result-prefixes="i18n dri mets xlink xsl dim xhtml mods dc">

    <xsl:variable name="context-path"
    
select="/dri:document/dri:meta/dri:pageMeta/dri:metada...@element='contextPath'][not(@qualifier)]"/>

    <xsl:variable name="data"
select="./mets:METS/mets:dmdSec/mets:mdWrap/mets:xmlData/dim:dim"/>

    <xsl:variable name="linefeed">
<xsl:text>
</xsl:text>
    </xsl:variable>



    <xsl:template match="/">
        <refworks>

            <!-- dc.type (must come first in export file) -->
            <field>
                <xsl:variable name="type"
select="$data/dim:fie...@element='type']"/>
                <xsl:text>RT </xsl:text>
                <xsl:choose>
                    <xsl:when
test="$type='Animation'">Artwork</xsl:when> <!-- ????? -DS -->
                    <xsl:when test="$type='Article'">Journal Article</xsl:when>
                    <xsl:when test="$type='Book'">Book, Whole</xsl:when>
                    <xsl:when test="$type='Book chapter'">Book,
Section</xsl:when>
                    <xsl:when test="$type='Dataset'">Unpublished
Material</xsl:when> <!-- I guess. -DS -->
                    <xsl:when test="$type='Learning
Object'">Unpublished Material</xsl:when> <!-- Ditto. -->
                    <xsl:when test="$type='Image'">Artwork</xsl:when>
                    <xsl:when test="$type='Image, 3-D'">Artwork</xsl:when>
                    <xsl:when test="$type='Journal Issue'">Journal,
Electronic</xsl:when>
                    <xsl:when test="$type='Map'">Map</xsl:when>
                    <xsl:when test="$type='Musical Score'">Music
Score</xsl:when>
                    <xsl:when test="$type='Plan or
blueprint'">Generic</xsl:when>
                    <xsl:when test="$type='Preprint'">Unpublished
Material</xsl:when>
                    <xsl:when test="$type='Presentation'">Unpublished
Material</xsl:when>
                    <xsl:when test="$type='Recording,
acoustical'">Sound Recording</xsl:when>
                    <xsl:when test="$type='Recording, musical'">Sound
Recording</xsl:when>
                    <xsl:when test="$type='Recording, oral'">Sound
Recording</xsl:when>
                    <xsl:when test="$type='Software'">Computer
Program</xsl:when>
                    <xsl:when test="$type='Technical Report'">Report</xsl:when>
                    <xsl:when
test="$type='Thesis'">Dissertation/Thesis</xsl:when>
                    <xsl:when test="$type='Video'">Video/DVD</xsl:when>
                    <xsl:when test="$type='Website'">Web Page</xsl:when>
                    <xsl:when test="$type='Working Paper'">Unpublished
Material</xsl:when>
                    <xsl:when test="$type='Other'">Generic</xsl:when>
                    <xsl:otherwise>Generic</xsl:otherwise>
                </xsl:choose>
            </field>
            <xsl:copy-of select="$linefeed" />

            <!-- title -->
            <field>
                <xsl:text>T1 </xsl:text>
            <xsl:choose>
                <xsl:when test="$data/dim:fie...@element='title']">
                    <xsl:value-of

select="$data/dim:fie...@element='title'][1]/child::node()"/>
                </xsl:when>
                <xsl:otherwise>
                    <i18n:text>xmlui.dri2xhtml.METS-1.0.no-title</i18n:text>
                </xsl:otherwise>
            </xsl:choose>
            </field>
            <xsl:copy-of select="$linefeed" />

            <!-- alternative title -->
            <xsl:if
test="$data/dim:fie...@element='title']...@qualifier='alternative']">
                <field>
                    <xsl:text>T2 </xsl:text>
                    <xsl:copy-of
select="$data/dim:fie...@element='title' and
@qualifier='alternative']/child::node()"/>
                </field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>

            <!-- Authors/editors. This is pretty grotty, but there's
not much else I can do given RefWorks obtuseness. -DS -->
            <xsl:if
test="$data/dim:fie...@element='contributor']...@qualifier='author']">
                <xsl:for-each
select="$data/dim:fie...@element='contributor']...@qualifier='author']">
                    <field>
                        <xsl:text>A1 </xsl:text>
                        <xsl:copy-of select="text()"/>
                    </field>
                    <xsl:copy-of select="$linefeed" />
                </xsl:for-each>
            </xsl:if>
            <xsl:if test="$data/dim:fie...@element='creator']">
                    <xsl:for-each select="$data/dim:fie...@element='creator']">
                        <field>
                            <xsl:text>A1 </xsl:text>
                            <xsl:copy-of select="text()"/>
                        </field>
                        <xsl:copy-of select="$linefeed" />
                    </xsl:for-each>
            </xsl:if>
            <xsl:if
test="$data/dim:fie...@element='contributor']...@qualifier='editor']">
                    <xsl:for-each
select="$data/dim:fie...@element='contributor']...@qualifier='editor']">
                         <field>
                             <xsl:text>A2 </xsl:text>
                             <xsl:copy-of select="text()"/>
                         </field>
                        <xsl:copy-of select="$linefeed" />
                    </xsl:for-each>
            </xsl:if>
            <xsl:if
test="$data/dim:fie...@element='contributor']...@qualifier='translator']">
                <xsl:for-each
select="$data/dim:fie...@element='contributor']...@qualifier='translator']">
                    <field>
                    <xsl:text>A4 </xsl:text>
                    <xsl:copy-of select="text()"/>
                    </field>
                    <xsl:copy-of select="$linefeed" />
                </xsl:for-each>
            </xsl:if>

            <!-- citation -->
            <xsl:if
test="$data/dim:fie...@element='identifier']...@qualifier='citation']">
                <field>
                <xsl:text>FD </xsl:text>
                <xsl:copy-of
select="$data/dim:fie...@element='identifier' and
@qualifier='citation']/child::node()"/>
                </field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>

            <!-- subject keywords -->
            <xsl:if test="$data/dim:fie...@element='subject']">
                <xsl:for-each select="$data/dim:fie...@element='subject']">
                    <field>
                      <xsl:text>K1 </xsl:text>
                      <xsl:copy-of select="text()"/>
                    </field>
                    <xsl:copy-of select="$linefeed" />
                </xsl:for-each>
            </xsl:if>

            <!-- date issued -->
            <xsl:if
test="$data/dim:fie...@element='date']...@qualifier='issued']">
                <xsl:variable name="fulldate"
select="$data/dim:fie...@element='date']...@qualifier='issued']"/>
                <field>
                  <xsl:text>YR </xsl:text>
                  <xsl:value-of select="substring(string($fulldate), 0,5)"/>
                </field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>

            <!-- publisher -->
            <xsl:if
test="$data/dim:fie...@element='publisher'][not(@qualifier)]">
                <field>
                    <xsl:text>PB </xsl:text>
                    <xsl:copy-of
select="$data/dim:fie...@element='publisher'][not(@qualifier)]/child::node()"/>
                </field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>

            <!-- abstract -->
            <xsl:if
test="$data/dim:fie...@element='description']...@qualifier='abstract']">
                <field>
                    <xsl:text>AB </xsl:text>
                    <xsl:copy-of
select="$data/dim:fie...@element='description' and
@qualifier='abstract']/child::node()"/>
                </field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>

            <!-- issn/isbn -->
            <xsl:if
test="$data/dim:fie...@element='identifier']...@qualifier='isbn']"><field>
                <xsl:text>SN </xsl:text>
                <xsl:copy-of
select="$data/dim:fie...@element='identifier' and
@qualifier='isbn']/child::node()"/></field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>
            <xsl:if
test="$data/dim:fie...@element='identifier']...@qualifier='issn']"><field>
                <xsl:text>SN </xsl:text>
                <xsl:copy-of
select="$data/dim:fie...@element='identifier' and
@qualifier='issn']/child::node()"/></field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>

            <!-- notes, which RW doesn't describe; I assume it's for
miscellaneous description -->
            <xsl:if
test="$data/dim:fie...@element='description'][not(@qualifier)]">
                <field>
                    <xsl:text>NO </xsl:text>
                    <xsl:copy-of
select="$data/dim:fie...@element='description'][not(@qualifier)]/child::node()"/>
                </field>
                <xsl:copy-of select="$linefeed" />
            </xsl:if>

            <!-- data source -->
            <field>
              <xsl:text>DS http://minds.wisconsin.edu/</xsl:text>
            </field>
            <xsl:copy-of select="$linefeed" />

        </refworks>
    </xsl:template>

</xsl:stylesheet>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to