Adding a field to be displayed with insert bibliography

H

Harrypsk

I am not experienced in editing XML for Word 2007. My intent is to edit the
Journal Article entry in the source manager for Word to include a URL field.

I have successfully edited the bibliography XML file to include the URL
field for that particular entry type.

I have not been successful in editing the APA.xml file to include the new
URL field when displaying a Journal Article in APA style when you insert the
bibliography.

Can anyone begin to piont me in the right direction? Can I post some of my
XML code to help?

Thanks.
 
Y

Yves Dhondt

Actually, the styles are in XSL, a transformation language on top of XML.

I'm guessing your intention is to edit APA.xsl (not .xml). Before starting
to play around with APA.xsl, I suggest you do the following:

1)create a copy of APA.xsl and call it MyAPA.xsl or something.
2)go into MyAPA.xsl and give the style a different name to show up in Word
(see http://bibword.codeplex.com/Wiki/View.aspx?title=FAQ#Q8)
3)save the file
4)(re)start Word to see if your new style is in there

Now you can change whatever you want in MyAPA.xsl without damaging the
original APA style.

In MyAPA.xsl, the entire bibliography formatting routine is located between

<xsl:when test="b:Bibliography">

and the matching

</xsl:when>

The routine consists of 2 parts. First a huge number of (common) variables
is defined. Then, the different bibliography items are formatted. The second
part starts around line 5658 and looks like this:

<xsl:choose>
<xsl:when test="b:SourceType='Book'">
<!-- A lot of code -->
</xsl:when>
<xsl:when test="b:SourceType='BookSection'">
<!-- A lot of code -->
</xsl:when>
<xsl:when test="b:SourceType='JournalArticle'">
<!-- A lot of code -->
</xsl:when>
<!-- Followed by all other types. -->
</xsl:choose>

What you are interested in, is the the piece of code between

<xsl:when test="b:SourceType='JournalArticle'">
<!-- A lot of code -->
</xsl:when>

The code inside again consists of 2 parts: one on how to display the
information if an author is available, and one on how to display the
information if there is no author available. If all you wanted to do was
display the URL at the end of a bibliography entry, you don't even have to
care about those 2 versions and can just put your code before the closing of
the xsl:when element. So you would get something along the following lines:

<xsl:when test="b:SourceType='JournalArticle'">
<!-- A lot of code -->

<!-- Your code -->
<xsl:if test="string-length(b:URL) > 0">
<!-- Display a leading space. -->
<xsl:text> </xsl:text>
<!-- Display the URL. -->
<xsl:value-of select="b:URL"/>
</xsl:if>
</xsl:when>

I did not have time to test the above code, so it might need some tweaking
or contain spelling errors. But it should get you on your way on where to
change what.

I'm interested in hearing how you "successfully edited the bibliography XML
file to include the URL field for that particular entry type". I'm assuming
you mean you edited bibform.xml to include URLs for journal articles. Or did
you do it differently?

Yves
 
H

Harrypsk

Yes, I edited the bibform.xml to add URL as a field for Journal Article.

I was not successful in getting that field to appear in the inserted
bibliography. I tried many different ways and just wasn't successful.

It's frustrating as it would be nice to customize those fields. I'm a
little shocked that URL isn't a field for every source anyway. Today's
research is done primarily via online library databases. I have about 100
references in my current paper so far and not a single journal article has
come from a physical journal. Even books are largely e-books these days.
 
Y

Yves Dhondt

I just tried this and it works for me.

Are you sure you added the URL field correctly in the bibform.xml?

Are you sure that the URL you type is actually stored correctly in your
document?

What you could do to check this is:
1)Open a new empty document
2)Add a journal article source with your URL field
3)Save your document and close it
4)Change the extension of your document in explorer from ".docx" to
".zip"
5)Browse the zip file and look for "item1.xml" in the "customXml" folder
6)Verify that the URL field is stored in your entry

If it's not there, then there is a problem with your bibform.xml.

Assuming the above works, did the 4 first steps (creating a new style) I
mentioned in my original reply work?

There are actually very few sources which are only published electronically.
Almost all things are still available in print. But I agree, there is a
serious lack for inputting electronic variants of classic types.

Yves
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top