469,950 Members | 1,432 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Extracting Citations

1
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:

Expand|Select|Wrap|Line Numbers
  1. <section>
  2. <para> This is my content <citation>Joe Smith, 1997 Journal of Medicine.</citation> This is more content <citation>Jane Doe, 2003, Cosmopolitan</citation>
  3. </para>
  4. <para> Even more content <citation>Joe Smith, 1997 Journal of Medicine.</citation>
  5. </para>
  6. </section>
The output I'm looking to have is the following:

Expand|Select|Wrap|Line Numbers
  1. <section>
  2. <para> This is my content (1) This is more content (2)</para>
  3. <para> Even more content (1)</para>
  4. </section>
  5. <section>
  6. <title> References </title>
  7. <listitem>1 - Joe Smith, 1997 Journal of Medicine. </listitem>
  8. <listitem>2 - Jane Doe, 2003, Cosmopolitan</listitem>
  9. </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.

Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="/">
  2.         <xsl:copy-of select = "."/>
  3.         <xsl:apply-templates select="//citation">     
  4.             <xsl:sort select="."/>
  5.         </xsl:apply-templates>         
  6.     </xsl:template>
  7.  
  8.     <xsl:template match="//citation">
  9.             <xsl:copy-of select = "."/>
  10.     </xsl:template>
Oct 3 '05 #1
0 1556

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Nazgul | last post: by
10 posts views Thread by Calvin FONG | last post: by
5 posts views Thread by Michael Hill | last post: by
1 post views Thread by Cognizance | last post: by
reply views Thread by k_nil | last post: by
reply views Thread by Jean-François Michaud | last post: by
2 posts views Thread by bjm | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.