Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8436039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:04:54+00:00 2026-06-10T07:04:54+00:00

I’m using the w3c bibtex transform to generate a bibtex file, but unfortunately it’s

  • 0

I’m using the w3c bibtex transform to generate a bibtex file, but unfortunately it’s generating duplicate author keys for papers in the same year.

  • Jones:2012
  • Jones:2012

The problem template is named bibtex-label in the xslt.

How could I add in a per-author, per-year count value so that the bibtex-label can look something like this:

  • Jones:2012a
  • Jones:2012b

I can’t find any good resources on doing this sort of thing, particularly with a non-xml output.

Example input (from here):

<rdf:RDF xmlns="http://www.w3.org/2001/02pd/rec54#"
    xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:doc="http://www.w3.org/2000/10/swap/pim/doc#"
    xmlns:mat="http://www.w3.org/2002/05/matrix/vocab#"
    xmlns:org="http://www.w3.org/2001/04/roadmap/org#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rec="http://www.w3.org/2001/02pd/rec54#">

    <REC rdf:about="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001">
        <dc:date>1998-10-01</dc:date>
        <dc:title>Document Object Model (DOM) Level 1</dc:title>
        <doc:versionOf rdf:resource="http://www.w3.org/TR/REC-DOM-Level-1"/>
        <editor rdf:parseType="Resource">
            <contact:fullName>Arnaud Le Hors</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Scott Isaacs</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Steve Byrne</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Mike Champion</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Gavin Nicol</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Lauren Wood</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Ian Jacobs</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Robert Sutor</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Jonathan Robie</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Chris Wilson</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Vidur Apparao</contact:fullName>
        </editor>
        <org:deliveredBy rdf:parseType="Resource">
            <contact:homePage rdf:resource="http://www.w3.org/DOM/Group/"/>
        </org:deliveredBy>
        <mat:hasErrata rdf:resource="http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html"/>
    </REC>


    <REC rdf:about="http://www.w3.org/TR/1998/REC-html40-19980424">
        <rdf:type rdf:resource="http://www.w3.org/2001/02pd/rec54#Superseded"/>
        <dc:date>1998-04-24</dc:date>
        <dc:title>HTML 4.0 Specification</dc:title>
        <doc:versionOf rdf:resource="http://www.w3.org/TR/html40"/>
        <editor rdf:parseType="Resource">
            <contact:fullName>Arnaud Le Hors</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>Ian Jacobs</contact:fullName>
        </editor>
        <editor rdf:parseType="Resource">
            <contact:fullName>David Raggett</contact:fullName>
        </editor>
        <previousEdition rdf:resource="http://www.w3.org/TR/REC-html40-971218"/>
        <org:deliveredBy rdf:parseType="Resource">
            <contact:homePage rdf:resource="http://www.w3.org/MarkUp/"/>
        </org:deliveredBy>
        <mat:hasErrata rdf:resource="http://www.w3.org/MarkUp/html40-updates/REC-html40-19980424-errata.html"/>
    </REC>

</rdf:RDF>

Example output (full):

@TechReport{LeHors:1998,
  author = {Arnaud Le Hors and Scott Isaacs and Steve Byrne and Mike Champion and Gavin Nicol and Lauren Wood and Ian Jacobs and Robert Sutor and Jonathan Robie and Chris Wilson and Vidur Apparao},
  title  = {{Document Object Model (DOM) Level 1}},
  note = {\url{http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001}. Latest version available at \url{http://www.w3.org/TR/REC-DOM-Level-1}},
  year = {1998},
  month = nov,
  bibsource = "http://www.w3.org/2002/01/tr-automation/tr.rdf",
  type = "Recommendation",
  institution = "W3C",
}

@TechReport{LeHors:1998,
  author = {Arnaud Le Hors and Ian Jacobs and David Raggett},
  title  = {{HTML 4.0 Specification}},
  note = {\url{http://www.w3.org/TR/1998/REC-html40-19980424}. Latest version available at \url{http://www.w3.org/TR/html40}},
  year = {1998},
  month = apr,
  bibsource = "http://www.w3.org/2002/01/tr-automation/tr.rdf",
  type = "Recommendation",
  institution = "W3C",
}

Desired output:

@TechReport{LeHors:1998a,
  author = {Arnaud Le Hors and Scott Isaacs and Steve Byrne and Mike Champion and Gavin Nicol and Lauren Wood and Ian Jacobs and Robert Sutor and Jonathan Robie and Chris Wilson and Vidur Apparao},
  title  = {{Document Object Model (DOM) Level 1}},
  note = {\url{http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001}. Latest version available at \url{http://www.w3.org/TR/REC-DOM-Level-1}},
  year = {1998},
  month = nov,
  bibsource = "http://www.w3.org/2002/01/tr-automation/tr.rdf",
  type = "Recommendation",
  institution = "W3C",
}

@TechReport{LeHors:1998b,
  author = {Arnaud Le Hors and Ian Jacobs and David Raggett},
  title  = {{HTML 4.0 Specification}},
  note = {\url{http://www.w3.org/TR/1998/REC-html40-19980424}. Latest version available at \url{http://www.w3.org/TR/html40}},
  year = {1998},
  month = apr,
  bibsource = "http://www.w3.org/2002/01/tr-automation/tr.rdf",
  type = "Recommendation",
  institution = "W3C",
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:04:55+00:00Added an answer on June 10, 2026 at 7:04 am

    Firstly, to simplify your translate function for the safeSurname function, you could define two variables at the top of your XSLT, like so

    <xsl:variable name="nameIn" 
       select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.- 0123456789ñÑçÇáéíóúÃÉÃÓÚäëïöüÄËÃÖÜ'" />
    <xsl:variable name="nameOut" 
       select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
    

    This would then allow you to write the more readable code to get the formatted surname

    <xsl:variable name="safeSurname" select="translate($surname, $nameIn, $nameOut)" />
    

    It becomes more clear when you see the code to generate the suffix, which can be achieved using the xsl:number function to count the number of preceding siblings with a matching year and surname. Note the use of the format attribute to output a letter rather than a number:

    <xsl:number 
       value="count(preceding-sibling::rec:REC
          [substring-before(dc:date/text(), '-') = $date]
          [translate(substring-after(rec:editor[1]/contact:fullName, ' '), $nameIn, $nameOut) = $safeSurname]
       ) + 1" 
       format="a"/>
    

    In this code $date is the year of the current REC element.

    Here is the full matching template for bibtex-label. Note I have removed the call to the dc:date template with mode bibtex-year just to keep the code all in one template.

    <xsl:template match="*" mode="bibtex-label">
      <xsl:variable name="surname" select="substring-after(rec:editor[1]/contact:fullName, ' ')"/>
      <xsl:variable name="safeSurname" select="translate($surname, $nameIn, $nameOut)" />
      <xsl:variable name="date"  select="substring-before(dc:date/text(), '-')"/>
      <xsl:value-of select="concat($safeSurname, ':', $date)" />
      <xsl:number value="count(preceding-sibling::rec:REC[substring-before(dc:date/text(), '-') = $date][translate(substring-after(rec:editor[1]/contact:fullName, ' '), $nameIn, $nameOut) = $safeSurname]) + 1" format="a"/>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.