如何修改参考文献样式及Word XML以控制引用作者显示数量?
Hey there! Let's break down how to solve your bibliography styling issues, both through Word's built-in tools and direct XML/XSLT edits:
1. How to modify bibliography styles to control the number of authors displayed
First, if you prefer not to dive into code right away, Word has built-in settings for this (though they vary by style):
- Open your Word document, go to the References tab, find the Styles group, and click the dropdown to select Manage Styles
- Locate the bibliography style you're using (e.g., APA, a custom style), then click Modify
- In the style modification window, click the Format button at the bottom, then select Citation
- You'll see options to set the "Maximum number of authors to display" and when to switch to "et al." Adjust these values to control how many authors show up before truncating.
If your style doesn't have these options (common with custom styles), you'll need to edit the underlying XML/XSLT file—let's cover that next for your specific request.
2. Modifying Word's XML to show only the first author + "et al"
Your goal is to change citations like (ARAÚJO, CÂMARA, et al ., 2005) to (ARAÚJO et al, 2005)—here's how to do it by editing the style's XSLT file:
Step 1: Export your current bibliography style
- Go to References > Styles > Manage Styles
- Right-click your target style, select Export, and save it as an
.xslfile (this is the XML-based style sheet Word uses for citations)
Step 2: Edit the XSLT file to truncate authors
Open the .xsl file in a text editor like Notepad++ or VS Code, then find the section that controls citation author formatting (usually in a template named CitationAuthor or similar):
- Look for code that loops through authors or checks the number of authors (e.g.,
<xsl:if test="count(authors) > 1">or<xsl:for-each select="authors/author">) - Replace that logic to only display the first author, then add "et al" if there are multiple authors. For example:
Original code (might vary slightly by style):
<xsl:for-each select="authors/author"> <xsl:if test="position() > 1"> <xsl:text>, </xsl:text> </xsl:if> <xsl:value-of select="name/surname"/> </xsl:for-each> <xsl:if test="count(authors) > 2"> <xsl:text>, et al</xsl:text> </xsl:if>
Modified code to show only first author + et al:
<!-- Show only the first author's surname --> <xsl:value-of select="authors/author[1]/name/surname"/> <!-- Add "et al" if there's more than one author --> <xsl:if test="count(authors) > 1"> <xsl:text> et al</xsl:text> </xsl:if>
- Don't forget to clean up extra punctuation (like the comma before "et al" in your original format) to match your desired output.
Step 3: Import the modified style back into Word
- Go back to Manage Styles, click Import, select your edited
.xslfile - Apply the updated style to your document, and your citations should now display only the first author followed by "et al".
Learning resources and next steps
Since Microsoft's official docs for bibliography XSLT are sparse, here are the best ways to learn:
- Start with XSLT 1.0 basics: Word uses XSLT 1.0 for these styles, so learning core concepts like templates, loops, and conditional logic will help you tweak any style.
- Dissect built-in styles: Export Word's default styles (like APA 7th or MLA) and compare their code to see how different formatting rules are implemented. This is one of the most practical ways to learn.
- Check Office's support articles: Search Word's built-in help for "customize bibliography styles"—you'll find guides on basic tweaks, which can lead you to more advanced XML editing tips.
- Community examples: Look for user-shared custom styles on academic forums or Office communities—seeing real-world code will help you adapt techniques to your needs.
内容的提问来源于stack exchange,提问作者Felipe

