View Single Post
  #35   Report Post  
Posted to microsoft.public.word.docmanagement
p0 p0 is offline
external usenet poster
 
Posts: 254
Default How can I make a custom bibliography style?

On 24 sep, 13:29, Nat wrote:
Hi,

I have a problem with ISO 690 in Word 2007. It references 'JournalArticle' *
and 'ConferenceProceedings' with Title, Year and not with Author, Year as is
the case with Boks, all other . *

So instead of (Rogers, 2005) it displays (Towards Movement Friendly
Computing in an Office Environment, 2005).

Does anyone know how to change the XSL code.

Thanks
Natasa *


Hello Natasa,

I suggest you make a copy of "ISO690.xsl" and name it "ISO690Alt.xsl"
or something before starting to mess around with it. In the new file,
look for:

xsl:when test="b:OfficeStyleKey"
xsl:textISO690FED/xsl:text
/xsl:when

and replace it by:

xsl:when test="b:StyleName"
xsl:textISO 690 - First Name Alternative/xsl:text
/xsl:when

If you save this style, and start Word 2007, a new style called "ISO
690 - First Name Alternative" will now be available.

First, I'll show you how to change the citation. Around line 3657, you
have a piece code looking like this:

xsl:when test="(msxsl:node-set($ListPopulatedWithMain)/b:Citation/
b:Source/b:SourceType = 'JournalArticle' or
msxsl:node-set($ListPopulatedWithMain)/b:Citation/b:Source/
b:SourceType = 'ConferenceProceedings') and string-length(msxsl:node-
set($ListPopulatedWithMain)/b:Citation/b:Source/b:Title) 0"
xsl:value-of select="msxsl:node-set($ListPopulatedWithMain)/
b:Citation/b:Source/b:Title" /
/xsl:when

This code actually says that if your source is a conference proceeding
or a journal article, it should display the title. If you would check
the code below, you would see that otherwise the main contributors are
displayed. As you don't want to display the title, remove the above
code. Now your citations for conference proceedings and journal
articles look like those for books.

Of course, your bibliography is still sorted by means of the title for
conference proceedings and journal articles. So you might want to
change that as well.

Elements are sorted based on the value generated for the SortingString
element.

b:SortingString
xsl:if test = "(b:SourceType = 'JournalArticle' or b:SourceType =
'ConferenceProceedings') and string-length(b:Title) 0"
xsl:text /xsl:text
xsl:value-of select="b:Title"/
/xsl:if

xsl:variable name = "author0"
xsl:for-each select="./b:Author/*[local-name()=
$MostImportantAuthorLocalName]"
xsl:call-template name="formatPersons"
xsl:with-param name = "forceMain" select = "'yes'" /
/xsl:call-template
/xsl:for-each
/xsl:variable

xsl:variable name = "author"
xsl:choose
xsl:when test="string-length(./b:Author/*[local-name()=
$MostImportantAuthorLocalName]/b:Corporate) 0"
xsl:value-of select="./b:Author/*[local-name()=
$MostImportantAuthorLocalName]/b:Corporate"/
/xsl:when
xsl:when test="string-length($author0) 0"
xsl:value-of select="$author0"/
/xsl:when
/xsl:choose
/xsl:variable

xsl:if test="string-length($author) 0"
xsl:text /xsl:text
xsl:value-of select="$author"/
/xsl:if

xsl:if test="string-length(b:Title) 0 and not (b:SourceType =
'JournalArticle' or b:SourceType = ConferenceProceedings')"
xsl:text /xsl:text
xsl:value-of select="b:Title"/
/xsl:if
/b:SortingString

It looks like a lot of code, but it is pretty easy to grasp. There are
basically three IF clauses:
1)if its a journal article or conference proceedings and there is a
title, add the title
2)if there are authors, add the authors
3)if its not a journal article or conference proceedings and there is
a title, add the title

So you want this changed into something looking like:

b:SortingString
xsl:variable name = "author0"
xsl:for-each select="./b:Author/*[local-name()=
$MostImportantAuthorLocalName]"
xsl:call-template name="formatPersons"
xsl:with-param name = "forceMain" select = "'yes'" /
/xsl:call-template
/xsl:for-each
/xsl:variable

xsl:variable name = "author"
xsl:choose
xsl:when test="string-length(./b:Author/*[local-name()=
$MostImportantAuthorLocalName]/b:Corporate) 0"
xsl:value-of select="./b:Author/*[local-name()=
$MostImportantAuthorLocalName]/b:Corporate"/
/xsl:when
xsl:when test="string-length($author0) 0"
xsl:value-of select="$author0"/
/xsl:when
/xsl:choose
/xsl:variable

xsl:if test="string-length($author) 0"
xsl:text /xsl:text
xsl:value-of select="$author"/
/xsl:if

xsl:if test="string-length(b:Title) 0"
xsl:text /xsl:text
xsl:value-of select="b:Title"/
/xsl:if
/b:SortingString

So now that the order of the bibliography is fixed, one thing is left
to do: displaying the journal articles and conference proceedings in
such a way that the authors are displayed before the title.

In the code there is a section looking like this (it's easily
identifiable as it is just above the single b in the entire code:

xsl:if test="b:SourceType='ConferenceProceedings' or
b:SourceType='JournalArticle'"
xsl:call-template name = "ApplyItalicTitleNS"
xsl:with-param name = "data"
xsl:choose
xsl:when test="(/b:Bibliography/b:Source[position()=
$prevBook]/b:SourceType = 'JournalArticle' or
/b:Bibliography/b:Source[position()=$prevBook]/b:SourceType =
'ConferenceProceedings') and /b:Bibliography/b:Source[position()=
$prevBook]/b:Title = b:Title"
xsl:call-template name="templ_prop_ISO690_SameAuthor"/
xsl:call-template name="templ_prop_Dot"/
/xsl:when
xsl:when test="b:SourceType = 'JournalArticle' or
b:SourceType = 'ConferenceProceedings'"
xsl:copy-of select ='$TitleOfMonographParts'/
/xsl:when
/xsl:choose
/xsl:with-param
/xsl:call-template
/xsl:if

Removing the above code will remove the title for journal articles and
conference proceedings from the beginning. Actually, it removes them
completely from the bibliography. So now we have to add them again
else where. Now if you scroll until the end of the 'b'tag (denoted by
/b) you will see that a choose construction is given handling all
the source types. So here you would want to display the title again
and change

xsl:when test="b:SourceType='JournalArticle'"

into

xsl:when test="b:SourceType='JournalArticle'"
i
xsl:copy-of select ='$TitleOfMonographParts'/
/i

And

xsl:when test="b:SourceType='ArticleInAPeriodical'"

into

xsl:when test="b:SourceType='ArticleInAPeriodical'"
i
xsl:copy-of select ='$TitleOfMonographParts'/
/i

I added the 'i' tags so that the titles are displayed in italic, if
that is not what you want, you can just remove them.

I compiled all the changes described in this post into an xsl file
which you can find at http://www.codeplex.com/bibliography...eleaseId=17634

HTH,

Yves