Extracting Citations

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blee
    New Member
    • Sep 2005
    • 1

    Extracting Citations

    Hello everyone,

    I am a newbie to XSLT, and would appreciate any feedback from this experienced community.

    I'm attempting to extract inline citations from my document, put them at the end of the document, deduplicate them, and assign them the proper references.

    My document looks something like this:

    Code:
    <section>
    <para> This is my content <citation>Joe Smith, 1997 Journal of Medicine.</citation> This is more content <citation>Jane Doe, 2003, Cosmopolitan</citation>
    </para>
    <para> Even more content <citation>Joe Smith, 1997 Journal of Medicine.</citation>
    </para>
    </section>
    The output I'm looking to have is the following:

    Code:
    <section>
    <para> This is my content (1) This is more content (2)</para>
    <para> Even more content (1)</para>
    </section>
    <section>
    <title> References </title>
    <listitem>1 - Joe Smith, 1997 Journal of Medicine. </listitem>
    <listitem>2 - Jane Doe, 2003, Cosmopolitan</listitem>
    </section>
    I have done the following, which spits out the entire xml, plus my duplicated citations at the end of te document. At this point, I'm at a loss on how to dedup them, and more importantly, how to cross reference them and substitude the number of the reference.

    Thank you, any help is greatly appreciated.

    Code:
    <xsl:template match="/">
            <xsl:copy-of select = "."/>
            <xsl:apply-templates select="//citation">     
                <xsl:sort select="."/>
            </xsl:apply-templates>         
        </xsl:template>
       
        <xsl:template match="//citation">
                <xsl:copy-of select = "."/>
        </xsl:template>
    Last edited by Dormilich; Jan 9 '09, 07:11 AM. Reason: added [code] tags
Working...