none
Create Custom Bibliography Styles RRS feed

  • Question

  • Hello,

    i want to create a custom Bibliography Styles for word.
    i followed this guide:
    http://msdn.microsoft.com/en-us/library/office/jj851016.aspx#Biblio_BuildBasicStyle

    i done every thing it says. but from some reason i don't see my style in the dropdown box.

    can some one help me?

    thank you.

    here the code of the test file:

    <?xml version="1.0" encoding="utf-8" ?> 
    
    <!--List of the external resources that we are referencing-->
     
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
     
    <!--When the bibliography or citation is in your document, it's just HTML-->
     
    <xsl:output method="html" encoding="us-ascii"/>
       
    <!--Match the root element, and dispatch to its children-->
       
    <xsl:template match="/">
    
    <xsl:apply-templates select="*" />
    
    </xsl:template>
    <!--Set an optional version number for this style--> 
    
    <xsl:template match="b:version"> 
    
       <xsl:text>2006.5.07</xsl:text>
    
    </xsl:template>
    
    <xsl:when test="b:StyleNameLocalized"> 
       <xsl:choose> 
          <xsl:when test="b:StyleNameLocalized/b:Lcid='1033'"> 
             <xsl:text>TEST</xsl:text> 
          </xsl:when> 
    </xsl:when>
    
    
    <!--Specifies which fields should appear in the Create Source dialog box when in a collapsed state (The Show All Bibliography Fields check box is cleared)-->
    
    <xsl:template match="b:GetImportantFields[b:SourceType = 'Book']"> 
       <b:ImportantFields> 
          <b:ImportantField> 
             <xsl:text>b:Author/b:Author/b:NameList</xsl:text> 
          </b:ImportantField> 
          <b:ImportantField> 
             <xsl:text>b:Title</xsl:text> 
          </b:ImportantField> 
         <b:ImportantField> 
             <xsl:text>b:Year</xsl:text> 
          </b:ImportantField> 
          <b:ImportantField> 
             <xsl:text>b:City</xsl:text>
          </b:ImportantField> 
          <b:ImportantField> 
             <xsl:text>b:Publisher</xsl:text> 
          </b:ImportantField> 
       </b:ImportantFields> 
    </xsl:template>
    <!--Defines the output format for a simple Book (in the Bibliography) with important fields defined-->
    
    <xsl:template match="b:Source[b:SourceType = 'Book']"> 
    
    <!--Label the paragraph as an Office Bibliography paragraph-->
    
       <p> 
          <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/> 
          <xsl:text>, </xsl:text> 
          <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:First"/> 
          <xsl:text>. (</xsl:text> 
          <xsl:value-of select="b:Year"/> 
          <xsl:text>). </xsl:text> 
          <i> 
             <xsl:value-of select="b:Title"/> 
             <xsl:text>. </xsl:text> 
          </i> 
          <xsl:value-of select="b:City"/> 
          <xsl:text>: </xsl:text> 
          <xsl:value-of select="b:Publisher"/> 
          <xsl:text>.</xsl:text> 
       </p> 
    </xsl:template>
    <!--Defines the output of the entire Bibliography-->
     
    <xsl:template match="b:Bibliography"> 
    
       <html xmlns="http://www.w3.org/TR/REC-html40"> 
       
          <body> 
    
             <xsl:apply-templates select ="b:Source[b:SourceType = 'Book']"> 
    
             </xsl:apply-templates> 
    
          </body> 
       
       </html> 
    </xsl:template>
    <!--Defines the output of the Citation-->
    <xsl:template match="b:Citation/b:Source[b:SourceType = 'Book']"> 
       <html xmlns="http://www.w3.org/TR/REC-html40"> 
          <body> 
             <!-- Defines the output format as (Author, Year)--> 
             <xsl:text>(</xsl:text> 
                <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/> 
             <xsl:text>, </xsl:text> 
             <xsl:value-of select="b:Year"/> 
             <xsl:text>)</xsl:text> 
          </body> 
       </html> 
    </xsl:template>
    <xsl:template match="text()" /> </xsl:stylesheet>



    • Edited by AlexYou Saturday, January 4, 2014 12:49 PM
    Saturday, January 4, 2014 12:01 PM

Answers

  • Hi Alex,

    I found some mistakes when I copied the xsl into Visual Studio.
    1. The element of choose was not closed.
    2. The element of when was put in the wrong parent element
    The custom style appears in the dropdown box when I change the code to like below:

    <?xml version="1.0" encoding="utf-8" ?>
    
    <!--List of the external resources that we are referencing-->
    
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
    
      <!--When the bibliography or citation is in your document, it's just HTML-->
    
      <xsl:output method="html" encoding="us-ascii"/>
    
      <!--Match the root element, and dispatch to its children-->
    
      <xsl:template match="/">
    
        <xsl:apply-templates select="*" />
    
        <xsl:choose>
          <xsl:when test="b:StyleNameLocalized">
            <xsl:choose>
              <xsl:when test="b:StyleNameLocalized/b:Lcid='1033'">
                <xsl:text>TEST</xsl:text>
              </xsl:when>
            </xsl:choose>
          </xsl:when>
        </xsl:choose>
    
    
      </xsl:template>
      <!--Set an optional version number for this style-->
    
      <xsl:template match="b:version">
    
        <xsl:text>2006.5.07</xsl:text>
       
      </xsl:template>
      
     
      <!--Specifies which fields should appear in the Create Source dialog box when in a collapsed state (The Show All Bibliography Fields check box is cleared)-->
    
      <xsl:template match="b:GetImportantFields[b:SourceType = 'Book']">
        <b:ImportantFields>
          <b:ImportantField>
            <xsl:text>b:Author/b:Author/b:NameList</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:Title</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:Year</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:City</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:Publisher</xsl:text>
          </b:ImportantField>
        </b:ImportantFields>
      </xsl:template>
      <!--Defines the output format for a simple Book (in the Bibliography) with important fields defined-->
    
      <xsl:template match="b:Source[b:SourceType = 'Book']">
    
        <!--Label the paragraph as an Office Bibliography paragraph-->
    
        <p>
          <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
          <xsl:text>, </xsl:text>
          <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:First"/>
          <xsl:text>. (</xsl:text>
          <xsl:value-of select="b:Year"/>
          <xsl:text>). </xsl:text>
          <i>
            <xsl:value-of select="b:Title"/>
            <xsl:text>. </xsl:text>
          </i>
          <xsl:value-of select="b:City"/>
          <xsl:text>: </xsl:text>
          <xsl:value-of select="b:Publisher"/>
          <xsl:text>.</xsl:text>
        </p>
      </xsl:template>
      <!--Defines the output of the entire Bibliography-->
    
      <xsl:template match="b:Bibliography">
    
        <html xmlns="http://www.w3.org/TR/REC-html40">
    
          <body>
    
            <xsl:apply-templates select ="b:Source[b:SourceType = 'Book']">
    
            </xsl:apply-templates>
    
          </body>
    
        </html>
      </xsl:template>
      <!--Defines the output of the Citation-->
      <xsl:template match="b:Citation/b:Source[b:SourceType = 'Book']">
        <html xmlns="http://www.w3.org/TR/REC-html40">
          <body>
            <!-- Defines the output format as (Author, Year)-->
            <xsl:text>(</xsl:text>
            <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
            <xsl:text>, </xsl:text>
            <xsl:value-of select="b:Year"/>
            <xsl:text>)</xsl:text>
          </body>
        </html>
      </xsl:template>
      <xsl:template match="text()" />
    </xsl:stylesheet>
    

    In addition, I suggest you edit the xsl file by Visual Studio to reduce error. And you can study the format of bibliography style from build in styles under the folder of “%APPDATA%\Microsoft\Bibliography\Style”.

    Best regards

    Fei



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 6, 2014 6:23 AM
    Moderator

All replies

  • Hi Alex,

    I found some mistakes when I copied the xsl into Visual Studio.
    1. The element of choose was not closed.
    2. The element of when was put in the wrong parent element
    The custom style appears in the dropdown box when I change the code to like below:

    <?xml version="1.0" encoding="utf-8" ?>
    
    <!--List of the external resources that we are referencing-->
    
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
    
      <!--When the bibliography or citation is in your document, it's just HTML-->
    
      <xsl:output method="html" encoding="us-ascii"/>
    
      <!--Match the root element, and dispatch to its children-->
    
      <xsl:template match="/">
    
        <xsl:apply-templates select="*" />
    
        <xsl:choose>
          <xsl:when test="b:StyleNameLocalized">
            <xsl:choose>
              <xsl:when test="b:StyleNameLocalized/b:Lcid='1033'">
                <xsl:text>TEST</xsl:text>
              </xsl:when>
            </xsl:choose>
          </xsl:when>
        </xsl:choose>
    
    
      </xsl:template>
      <!--Set an optional version number for this style-->
    
      <xsl:template match="b:version">
    
        <xsl:text>2006.5.07</xsl:text>
       
      </xsl:template>
      
     
      <!--Specifies which fields should appear in the Create Source dialog box when in a collapsed state (The Show All Bibliography Fields check box is cleared)-->
    
      <xsl:template match="b:GetImportantFields[b:SourceType = 'Book']">
        <b:ImportantFields>
          <b:ImportantField>
            <xsl:text>b:Author/b:Author/b:NameList</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:Title</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:Year</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:City</xsl:text>
          </b:ImportantField>
          <b:ImportantField>
            <xsl:text>b:Publisher</xsl:text>
          </b:ImportantField>
        </b:ImportantFields>
      </xsl:template>
      <!--Defines the output format for a simple Book (in the Bibliography) with important fields defined-->
    
      <xsl:template match="b:Source[b:SourceType = 'Book']">
    
        <!--Label the paragraph as an Office Bibliography paragraph-->
    
        <p>
          <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
          <xsl:text>, </xsl:text>
          <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:First"/>
          <xsl:text>. (</xsl:text>
          <xsl:value-of select="b:Year"/>
          <xsl:text>). </xsl:text>
          <i>
            <xsl:value-of select="b:Title"/>
            <xsl:text>. </xsl:text>
          </i>
          <xsl:value-of select="b:City"/>
          <xsl:text>: </xsl:text>
          <xsl:value-of select="b:Publisher"/>
          <xsl:text>.</xsl:text>
        </p>
      </xsl:template>
      <!--Defines the output of the entire Bibliography-->
    
      <xsl:template match="b:Bibliography">
    
        <html xmlns="http://www.w3.org/TR/REC-html40">
    
          <body>
    
            <xsl:apply-templates select ="b:Source[b:SourceType = 'Book']">
    
            </xsl:apply-templates>
    
          </body>
    
        </html>
      </xsl:template>
      <!--Defines the output of the Citation-->
      <xsl:template match="b:Citation/b:Source[b:SourceType = 'Book']">
        <html xmlns="http://www.w3.org/TR/REC-html40">
          <body>
            <!-- Defines the output format as (Author, Year)-->
            <xsl:text>(</xsl:text>
            <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
            <xsl:text>, </xsl:text>
            <xsl:value-of select="b:Year"/>
            <xsl:text>)</xsl:text>
          </body>
        </html>
      </xsl:template>
      <xsl:template match="text()" />
    </xsl:stylesheet>
    

    In addition, I suggest you edit the xsl file by Visual Studio to reduce error. And you can study the format of bibliography style from build in styles under the folder of “%APPDATA%\Microsoft\Bibliography\Style”.

    Best regards

    Fei



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 6, 2014 6:23 AM
    Moderator
  • Hi Alex,

    Since we haven't heard from you for a long time, I temporarily close this case. I mark useful reply as answer. If you have any concerns, please free feel to reopen it or submit a new question.

    Thanks for your understanding.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 13, 2014 1:40 AM
    Moderator