View Single Post
  #49   Report Post  
Posted to microsoft.public.word.docmanagement
Yves Dhondt Yves Dhondt is offline
external usenet poster
 
Posts: 767
Default Update APA - Digital Object Identifier field

From a purely 'being compliant' point of view, you can't go adding new
fields. The resulting xml would not follow the standardized schema. The only
correct way of doing it would be through namespace subsumption but end-users
can't do that.

Luckely, Word 2007/2008 doesn't really care when it comes to validity. So
you can add almost anything you want, from new source types to new fields
attached to existing source types.

!!! ALWAYS CREATE BACKUPS BEFORE EDITING FILES !!!

To add a new field to the 'Edit Source' dialog, you will have to provide its
definition in 'bibform.xml'. 'bibform.xml' is language dependent and you can
find the one you use in

winword.exe directory\LCID\Bibliography

where LCID is your language and cultural identifier. It's a 4 (or 5) digit
value. The default one (en-us) is 1033. For a full list, see
http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

When you check out 'bibform.xml', you will find the following structu

Forms
--Source = you have one of these for every type of supported
source (Book, BookSection, ...)
----Tag = you have one of these for every field the source
supports (Author, Year, ...)
------Label = this is the string that will be shown to the right of
the input box
------DataTag = this is tells Word where to store the data entered in
the xml
------Sample = this is an example value as shown at the bottom of the
'Edit Source' dialog.

So when you want to add a new DOI field to a certain type, you will have to
provide a new tag element for the necessary source elements. The element
could look something like this:

Tag
LabelDOI/Label
DataTagbOI/DataTag
SampleExample: 10.1000/182/Sample
/Tag

Once you saved your adjusted 'bibform.xml' and start up Word, you will find
the newly added fields in the 'Edit Source' dialog when you select 'Show All
Bibliography Fields'.

As Open XML does not define which fields belong to which source type (they
use a flat structure), you can, without breaking anything, add existing
elements to sources who are missing them. So it is possible to add a b:URL,
bayAccessed, b:MonthAccessed, and b:YearAccessed element to an ordinary
Book source without breaking anything. Of course, non existing elements such
as bOI break validity.

So think about it, before you break it. I mean, if you use a separate field
for a DOI the underlying xml will become invalid. Not that Word cares at the
moment, but what if one day it will? Or what if someone else needs to open
your document on another word processor. They might expect valid sources,
and you will be giving them something invalid. A DOI is just another
standard number like you have ISBN or ISSN. Why not use the same field
(b:StandardNumber) they use? APA doesn't care about ISBN or ISSN anyway. It
doesn't use the standard number. So you can safely add a b:StandardNumber to
any Source element in your bibform.xml without breaking anything.




Next you may want to control the importance of the field. That is, should
the field be shown in the 'Edit Source' dialog by default, or should it only
be available when 'Show All Bibliography Fields' is selected. The importance
of a field is defined on a per style basis as some styles think an issue
number is important while others think it is not. This means that it is
defined in the xsl files.

What happens is that Word sends a 'b:GetImportantFields/b:SourceType' to the
xsl. The xsl replies with 'b:ImportantFields' element containing the data
tags of the important elements. So for example, when Word want to know what
the important fields are for journal articles in APA, it sends

b:GetImportantFields
b:SourceTypeJournalArticle/b:SourceType
/b:GetImportantFields

And APA.xsl replies with:

b:ImportantFields
b:ImportantField
xsl:textb:Author/b:Author/b:NameList/xsl:text
/b:ImportantField
b:ImportantField
xsl:textb:Title/xsl:text
/b:ImportantField
b:ImportantField
xsl:textb:JournalName/xsl:text
/b:ImportantField
b:ImportantField
xsl:textb:Year/xsl:text
/b:ImportantField
b:ImportantField
xsl:textb:Pages/xsl:text
/b:ImportantField
/b:ImportantFields

So if you wanted to ensure that the 'Issue' field would show up by default,
you would have to add a:

b:ImportantField
xsl:textb:Issue/xsl:text
/b:ImportantField

Where and how this operation is defined inside the xsl depends on how the
xsl was created. In APA.xsl, the easiest thing is to look for:

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

You can of course substitute JournalArticle for other types of sources.




Now that you can define new fields and mark them as important or not, there
is one step left to do: displaying your field in a citation or bibliography.
I'm only going to consider a bibliography here but the principle is similar
for in-text citations.

When Word wants to format a bibliography, it sends a list of all the sources
it wants in the bibliography wrapped in a b:Bibliography element. The xsl
does its magic with that input and returns an HTML file. Word then takes
that HTML file and inserts it into your document. So Word gives something
like:

b:Bibliography
!-- some localized stuff like what is 'and' in your language --
b:Source
!-- the content of the source --
/b:Source
b:Source
!-- the content of the source --
/b:Source
b:Source
!-- the content of the source --
/b:Source
/b:Bibliography

And gets back something in the lines of

html
head/head
body
pMy first source/p
pMy second source/p
pMy third source/p
/body
/html

As to how the different p elements in the above html are generated, that's
up to the creator of the xsl. The principle is simple but the process is
complex. The reason is, you have to cover every possible case (well you
don't have to, but it is polite to do so). The availability of one element
can influence the look of other elements or the separators between elements.
In the end, you get one giant heap of if loops. A mess to navigate through
(this is actually what BibWord tries to simplify) resulting in an xsl of a
few 1000 lines scaring people away.

Some style authors try to add some order to this madness. For example, in
the APA stylesheet, you can look for:

xsl:when test="b:Bibliography"

This indicates where the bibliography formatting part begins. Then there is
a small piece of sorting your sources, after which each source is processed
using a for-each loop:

xsl:for-each select="msxsl:node-set($sList)/b:Bibliography/b:Source"

In that loop, a number of variables are calculated first. Things like the
number of authors, how the title should look like (italics, bold, ...). The
second part of the loop then display the source based on its type and those
variables. You will find a piece of code looking like:

xsl:choose
xsl:when test="b:SourceType='Book'"
!-- display information if your source is a book --
/xsl:when
xsl:when test="b:SourceType='BookSection'"
!-- display information if your source is a section of a book --
/xsl:when
!-- other types of sources --
xsl:choose

If you want to add your DOI, you will have to do it here. If you are lucky
enough that your DOI just has to be at the end of the reference, you can
move to just before the /xsl:when of the source type you want to add it to
and put your code there. Your code could be something simple like checking
if there is a DOI, and if so, display it. So you would get something looking
like:

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

Of course, if you want it elsewhere, you will have to start looking through
the code.

On a final note, unless you can think of some good reasons, you really
should consider using the StandardNumber field rather than inventing your
own DOI field.

Yves
--
BibWord : Microsoft Word Citation and Bibliography styles
http://bibword.codeplex.com

"Julie T" Julie wrote in message
...

Yves,

APA has been updated where I have to carry in the "DOI." Do you know how
to
add a new field in XLST? Also, I need the issue number to be a mandatory
field.

Example:
Klimoski, R., & Palmer, S. (1993). The ADA and the hiring process in
organizations. Consulting Psychology Journal: Practice and Research,
45(2),
10-36. doi:10.1037/1061-4087.45.2.10


Thank you,