<div dir="ltr">Just for reference, I figured how how to do the OCLC number reformatting in XSLT.<div><br></div><div>If we have a file 'format_oclc.marcxml':</div><div><br></div><div><div><?xml version="1.0" encoding="UTF-8"?></div><div><record</div><div>    xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"</div><div>    xsi:schemaLocation="<a href="http://www.loc.gov/MARC21/slim">http://www.loc.gov/MARC21/slim</a> <a href="http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd</a>"</div><div>    xmlns="<a href="http://www.loc.gov/MARC21/slim">http://www.loc.gov/MARC21/slim</a>"></div><div><br></div><div>  <datafield tag="773" ind1=" " ind2=" "></div><div>    <subfield code="w">(OCoLC)2776588</subfield></div><div>    <subfield code="w">(OCoLC)12776588</subfield></div><div>    <subfield code="w">(OCoLC)112776588</subfield></div><div>  </datafield></div><div></record></div></div><div><br></div><div>And an xslt file 'format_oclc.xslt':</div><div><br></div><div><div><!DOCTYPE stylesheet ></div><div><xsl:stylesheet version="1.0" xmlns:marc="<a href="http://www.loc.gov/MARC21/slim">http://www.loc.gov/MARC21/slim</a>" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</a>" ></div><div><br></div><div>    <xsl:template name="format_OCLC_number"></div><div>        <xsl:param name="controlnumber"/></div><div>        <xsl:variable name="OCLC_number" select="substring-after($controlnumber,'(OCoLC)')"/></div><div>        <xsl:variable name="OCLC_length" select="string-length($OCLC_number)"/></div><div>        <xsl:if test="$OCLC_number"></div><div>            <xsl:choose></div><div>                <xsl:when test="$OCLC_length &lt; 8"></div><div>                    <xsl:variable name="OCLC_number_padding" select="substring( '00000000', 1, 8 - $OCLC_length)"/></div><div>                    <xsl:variable name="formatted_OCLC_number" select="concat( $OCLC_number_padding, $OCLC_number )"/></div><div>                    <xsl:value-of select="concat( 'ocm', $formatted_OCLC_number )" /></div><div>                </xsl:when></div><div>                <xsl:when test="$OCLC_length = 8"></div><div>                    <xsl:value-of select="concat( 'ocn', $OCLC_number )" /></div><div>                </xsl:when></div><div>                <xsl:otherwise></div><div>                    <xsl:value-of select="concat( 'on', $OCLC_number )" /></div><div>                </xsl:otherwise></div><div>            </xsl:choose></div><div>        </xsl:if></div><div>    </xsl:template></div><div><br></div><div>    <xsl:template match="marc:record"></div><div>        <xsl:for-each select="marc:datafield[@tag=773]"></div><div>            <xsl:for-each select="current()/marc:subfield[@code='w']"></div><div>                <xsl:call-template name="format_OCLC_number"></div><div>                    <xsl:with-param name="controlnumber" select="current()"/></div><div>                </xsl:call-template></div><div>                <xsl:value-of select="'</div><div>                '" /></div><div>            </xsl:for-each></div><div>        </xsl:for-each></div><div>    </xsl:template></div><div><br></div><div></xsl:stylesheet></div></div><div><br></div><div>we can run xsltproc:</div><div><br></div><div><div>$ xsltproc format_oclc.xslt format_oclc.marcxml</div><div><?xml version="1.0"?></div><div>ocm02776588                 ocn12776588                 on112776588           </div></div><div><br></div><div>I'll be filing a bug/patch relatively soon that incorporates this.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 26, 2018 at 4:58 AM, Katrin Fischer <span dir="ltr"><<a href="mailto:katrin.fischer.83@web.de" target="_blank">katrin.fischer.83@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>I don't know about other sources, but in Germany I've never
      encountered data where the numbers in $w minus MarcOrgCode don't
      match the one in 001. Maybe this problem is just specific to OCLC?</p><span class="HOEnZb"><font color="#888888">
    <p>Katrin<br>
    </p></font></span><div><div class="h5">
    <br>
    <div class="m_-8836200427356326290moz-cite-prefix">On 25.05.2018 20:06, Barton Chittenden
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Thu, May 24, 2018 at 3:34 PM,
            Katrin Fischer <span dir="ltr"><<a href="mailto:katrin.fischer.83@web.de" target="_blank">katrin.fischer.83@web.de</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF">
                <p>Hi Barton,</p>
                <p>Control-number is the index on 001. 001 should have
                  the number and 003 the MarcOrgCode, that's why it's
                  stripped from $w for search. I don't know about OCLCs
                  practices, so can't tell how numbers are handled
                  there. The examples here show a number with ocm in
                  001:</p>
                <p><a class="m_-8836200427356326290gmail-m_-6366753341428443150moz-txt-link-freetext" href="http://www.loc.gov/marc/bibliographic/bd001.html" target="_blank">http://www.loc.gov/marc/biblio<wbr>graphic/bd001.html</a></p>
              </div>
            </blockquote>
            <div>From that link:</div>
            <div><br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Contains the control
              number assigned by the organization creating, using, or
              distributing the record. For interchange purposes,
              documentation of the structure of the control number and
              input conventions should be provided to exchange partners
              by the organization initiating the interchange.</blockquote>
            <div><br>
            </div>
            <div>That potentially means that we would have to write XSLT
              to transform the links in $w for each 'exchange partner'
              -- i.e. test the Marc Org Code, then apply a bunch of
              rules to generate a value that we can search for.</div>
            <div><br>
            </div>
            <div>The examples don't leave me brimming with confidence
              that most exchange partners will use the same format for
              $w (after the Org Code) as for the 001:</div>
            <div><br>
            </div>
          </div>
        </div>
        <blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
          <div class="gmail_extra">
            <div class="gmail_quote">
              <div class="m_-8836200427356326290example">
                <table width="100%">
                  <tbody>
                    <tr>
                      <td width="5%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="15%" valign="top" align="left"><br>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left"><strong>001</strong></td>
                      <td colspan="8" valign="top" align="left">#880524405##</td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left">003</td>
                      <td colspan="8" valign="top" align="left">CaOONL</td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left"><br>
                      </td>
                      <td colspan="9" valign="top" align="left"><br>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
              <div class="m_-8836200427356326290example">
                <table width="100%">
                  <tbody>
                    <tr>
                      <td width="5%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="15%" valign="top" align="left"><br>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left"><strong>001</strong></td>
                      <td colspan="8" valign="top" align="left">###86104385#</td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left">003</td>
                      <td colspan="8" valign="top" align="left">DLC</td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left"><br>
                      </td>
                      <td colspan="9" valign="top" align="left"><br>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
              <div class="m_-8836200427356326290example">
                <table width="100%">
                  <tbody>
                    <tr>
                      <td width="5%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="15%" valign="top" align="left"><br>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left"><strong>001</strong></td>
                      <td colspan="8" valign="top" align="left">ocm14919759</td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left">003</td>
                      <td colspan="8" valign="top" align="left">OCoLC</td>
                    </tr>
                  </tbody>
                </table>
              </div>
              <div class="m_-8836200427356326290example">
                <table width="100%">
                  <tbody>
                    <tr>
                      <td width="5%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="10%" valign="top" align="left"><br>
                      </td>
                      <td width="15%" valign="top" align="left"><br>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left"><strong>001</strong></td>
                      <td colspan="8" valign="top" align="left">#####9007496</td>
                    </tr>
                    <tr>
                      <td colspan="1" valign="top" align="left">003</td>
                      <td colspan="8" valign="top" align="left">DNLM</td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div class="gmail_extra">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF">
                <p>The description for $w (<a class="m_-8836200427356326290gmail-m_-6366753341428443150moz-txt-link-freetext" href="http://www.loc.gov/marc/bibliographic/bd76x78x.html" target="_blank">http://www.loc.gov/marc/bibli<wbr>ographic/bd76x78x.html</a>)
                  doesn't have a matching example:</p>
                <p>"System control number of the related record preceded
                  by the MARC code, enclosed in parentheses, for the
                  agency to which the control number applies."</p>
                <p>Hope this helps,</p>
                <p>Katrin<br>
                </p>
              </div>
            </blockquote>
            <div>Well, at the very least, it lets me know what I'm
              getting myself into.</div>
            <div><br>
            </div>
            <div>I wonder if there's a way of translating the values
              found in $w into 001 outside of XSLT -- that's a language
              not well suited to the task. Could we do it in perl, and
              stash the results in some 9XX field?</div>
            <div><br>
            </div>
            <div>I was kind of hoping that we would be able to use
              whatever we got back from extractControlNumber as a base
              for any transformations. That may or may not be a safe
              assumption.</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF">
                <p> </p>
                <div>
                  <div class="m_-8836200427356326290gmail-h5">
                    <div class="m_-8836200427356326290gmail-m_-6366753341428443150moz-cite-prefix"><br>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>