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

Thank you very much for your help! It works perfectly.

"p0" wrote:

formatSecondaryName is for a possible second group of contributors to
a work (for example in book sections) not for the second (or further)
person of the main contributors.

I suggest adding a template "formatMainAuthorAfterFirst" to the
stylesheet. As the name suggests, it describes how to format the main
author after the first person. Since you want first name followed by
last name, the template would look something like this:

xsl:template name="formatMainAuthorAfterFirst"
xsl:call-template name="formatNameCore"
xsl:with-param name="FML"
xsl:value-of select="'%F %M %L'"/
/xsl:with-param
xsl:with-param name="FM"
xsl:value-of select="'%F %M'"/
/xsl:with-param
xsl:with-param name="ML"
xsl:value-of select="'%M %L'"/
/xsl:with-param
xsl:with-param name="FL"
xsl:value-of select="'%F %L'"/
/xsl:with-param
xsl:with-param name="upperLast"no/xsl:with-param
xsl:with-param name="withDot"yes/xsl:with-param

/xsl:call-template
/xsl:template

Currently, a set of main authors is formatted using the following
code:

xsl:template name="formatPersonsAuthor"
xsl:if test="string-length(b:Corporate)=0"
xsl:for-each select="b:NameList/b:Person"
xsl:if test="position() = 1"
xsl:call-template name="formatMainAuthor"/
/xsl:if
xsl:if test="6 = position() and position() != 1"
xsl:call-template name="formatMainAuthor"/
/xsl:if
xsl:call-template name="formatPersonSeperatorMain"/
/xsl:for-each
/xsl:if

xsl:if test="string-length(b:Corporate)0"
xsl:value-of select="b:Corporate"/
/xsl:if
/xsl:template

Here you can see that Microsoft already thought of people who want
their second person displayed differently from their first. The second
'if' statement (xsl:if test="6 = position() and position() != 1")
indicates how the persons 2 to 6 should be handled. In the above code,
they should be handled just like the first person. So here you can
call your newly defined template instead of the old one. Hence you
would change the code from:

xsl:if test="6 = position() and position() != 1"
xsl:call-template name="formatMainAuthor"/
/xsl:if

into:

xsl:if test="6 = position() and position() != 1"
xsl:call-template name="formatMainAuthorAfterFirst"/
/xsl:if

Regards,

Yves

On 4 sep, 19:49, chrog wrote:
Thanks this did the trick; it is working great!!!! One other quesiton that
you might be able to help with. When there are two authors for some source
the second is always listed as LAST, FIRST but I want it the other way around.

For example:
Smith, John and Jane Doe. 2020. etc.

not

Smith, John and Doe, Jane. 2020. etc.

I tried to make some adjustments in the (formatSecondaryName) part of the
code but nothing changed. Any advice?



"p0" wrote:
On 4 sep, 05:06, Chrog wrote:
Hello, I have been reading this string of posts and I think that maybe
someone here might be able to help me. I need to alter the APA style to the
LSA style. They are pretty much the same except Word 2007 keeps truncating
some author's first names, and putting parentheses aroung the date.


I am pretty sure there is a limit on the string length for the author's name
that might be increased but I have no idea where to look for it. I have no
clue how to fix the parentheses issue.


Before toying around with the APA.xsl I suggest you make a copy of it
and call it LSA.xsl. Put the copy in the same directory as APA.xsl.
Open up your new created LSA.xsl and look for a piece of xml looking
like this:
xsl:when test="b:OfficeStyleKey"
xsl:textAPA/xsl:text
/xsl:when


Change it into:
xsl:when test="b:StyleName"
xsl:textLSA/xsl:text
/xsl:when


Save the entire thing. Now when you start up Word, there will be an
LSA entry in the style list to pick from. Starting from here, you
should only play around with LSA.xsl and NOT with APA.xsl.


The parentheses around the year are put there during the declaration
of the "enclosedYearDot" variable by the following code (located
around line 5039):


xsl:variable name="enclosedYearDot"
xsl:if test="string-length($year)0"
xsl:call-template name="templ_prop_APA_GeneralOpen"/
xsl:value-of select="$year"/
xsl:call-template name="templ_prop_APA_GeneralClose"/
xsl:call-template name="templ_prop_Dot"/
/xsl:if
/xsl:variable


By removing the calls to templ_prop_APA_GeneralOpen and
templ_prop_APA_GeneralClose you will remove the brackets. So you would
get:


xsl:variable name="enclosedYearDot"
xsl:if test="string-length($year)0"
!--xsl:call-template name="templ_prop_APA_GeneralOpen"/--
xsl:value-of select="$year"/
!--xsl:call-template name="templ_prop_APA_GeneralClose"/--
xsl:call-template name="templ_prop_Dot"/
/xsl:if
/xsl:variable


Note that right under the declaration of enclosedYearDot,
enclosedDateDot and enclosedDateEmptyDot are declared. They put
'entire' dates between brackets. So you also might want to change
those if you don't want brackets around any date.


The name of one of the main contributors to a work is formatted as
follows:


xsl:template name="formatMainAuthor"
xsl:call-template name="formatNameCore"
xsl:with-param name="FML"
xsl:call-template name="templ_prop_APA_MainAuthors_FML"/
/xsl:with-param
xsl:with-param name="FM"
xsl:call-template name="templ_prop_APA_MainAuthors_FM"/
/xsl:with-param
xsl:with-param name="ML"
xsl:call-template name="templ_prop_APA_MainAuthors_ML"/
/xsl:with-param
xsl:with-param name="FL"
xsl:call-template name="templ_prop_APA_MainAuthors_FL"/
/xsl:with-param
xsl:with-param name="upperLast"no/xsl:with-param
xsl:with-param name="withDot"yes/xsl:with-param


/xsl:call-template
/xsl:template


with the following definitions (which you can't change directly):
templ_prop_APA_MainAuthors_FML = %L, %f %m
templ_prop_APA_MainAuthors_FM = %f %m
templ_prop_APA_MainAuthors_ML = %L, %m
templ_prop_APA_MainAuthors_FL = %L, %f
where lower case characters stands for initials and upper case
characters for the full name part. So if you don't want any of the
main authors names abbreviated, you could change the routine into:


xsl:template name="formatMainAuthor"
xsl:call-template name="formatNameCore"
xsl:with-param name="FML"
xsl:value-of select="'%L, %F %M'"/
/xsl:with-param
xsl:with-param name="FM"
xsl:value-of select="'%F %M'"/
/xsl:with-param
xsl:with-param name="ML"
xsl:value-of select="'%L, %M'"/
/xsl:with-param
xsl:with-param name="FL"
xsl:value-of select="'%L, %F'"/
/xsl:with-param
xsl:with-param name="upperLast"no/xsl:with-param
xsl:with-param name="withDot"yes/xsl:with-param


/xsl:call-template
/xsl:template


Once again, note that there is also a formatting routine for secondary
authors right beneath it (formatSecondaryName) which you might want to
change as well to your preferred format.


Yves