[MEI-L] @copyof and @sameas

TW zupftom at googlemail.com
Wed Jul 27 08:55:35 CEST 2011


In other words:  Is this an appropriate resolution for elements with @copyof:



<?xml version="1.0"?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:mei="http://www.music-encoding.org/ns/mei">
  <!-- Why doesn't the following work, at least not with all processors? -->
  <!--<key match="mei:*" name="id" use="@xml:id"/>-->
  <key match="mei:*" name="id" use="@*[local-name()='id' or
local-name()='xml:id']"/>


  <template match="/">
    <apply-templates select="*"/>
  </template>

  <template match="*">
    <copy>
      <apply-templates select="@*|node()"/>
    </copy>
  </template>

  <template match="@*">
    <copy-of select="."/>
  </template>

  <template match="mei:*[@copyof]">
    <copy>
      <apply-templates select="key('id', at copyof)/@*" mode="copy-without-ids"/>
      <!-- Attributes on the current node override those from referenced node.
           This stylesheet leaves the @copyof attribute in place as it does no
           harm and makes it possible to go back to the original
unresolved form -->
      <apply-templates select="@*"/>
      <apply-templates select="key('id', at copyof)/node()"
mode="copy-without-ids"/>
    </copy>
  </template>

  <template mode="copy-without-ids" match="*">
    <copy>
      <apply-templates select="@*|node()" mode="copy-without-ids"/>
    </copy>
  </template>

  <template match="@*" mode="copy-without-ids">
    <copy-of select="."/>
  </template>
  <template match="@xml:id" mode="copy-without-ids"/>

</stylesheet>



This could be a first small contribution to MEIron, but it doesn't
record anything in changedesc and appinfo.  What should be added to
those elements?  Shall we create a tools folder with an meiron
subfolder in the MEI_2011_dev branch to commit things like this?

Thomas Weber


2011/7/25 TW <zupftom at googlemail.com>:
> We discussed the meaning of @copyof and @sameas during the meeting in
> Detmold.  Just to reassure myself that my understanding of what we
> finally agreed on is correct:
>
> Elements with @copyof should not have content as the content is
> replaced by the content of the referenced element.  (Virtually
> replaced, or when "ironing", really replaced.)  The attributes are
> also copied, but only those that weren't already set.  IDs have to be
> changed or stripped to avoid duplicate IDs.
>
> @sameas means that two elements are actually (musically?) the same,
> but still have to be present twice (or more) in the MEI data.  Most
> common example is a rest that is shared by two voices on a single
> staff and has to be present in both layers.
>
> Is that about correct?
> Thomas Weber
>



More information about the mei-l mailing list