[MEI-L] @copyof and @sameas
Raffaele Viglianti
raffaeleviglianti at gmail.com
Wed Jul 27 10:01:24 CEST 2011
Hi Thomas,
I think your definition of @copyof and @sameas from your first email is
accurate.
Your XSLT seems correct too (I haven't ran it, though), but removing ids
might not be ideal. If an entire measure is copied, for example, there could
be some elements (say, slur) with @startid and @endid pointing at @xml:ids
within the measure. Removing the ids would break these references.
A possible solution is to generate new ids for the elements being copied and
adjust references within the copied context.
Even in this case, some references might remain ambiguous. Think of a slur
with an @endid that points to an element in the following measure. If the
measure with the slur is copied, but not the following, also the copied slur
will refer to the same element as the original, surely creating an error.
Would it make sense to try to build some awareness of references that go
over the copied context? (the same problem applies to values expressed in
timestamp)
Creating a tools/MEIron directory in SVN for XSLTs like this is an excellent
idea. Are you already a committer on googlecode?
Best,
Raffaele
On Jul 27, 2011 7:56 AM, "TW" <zupftom at googlemail.com> wrote:
> 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
>>
>
> _______________________________________________
> mei-l mailing list
> mei-l at lists.uni-paderborn.de
> https://lists.uni-paderborn.de/mailman/listinfo/mei-l
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-paderborn.de/pipermail/mei-l/attachments/20110727/f46e5901/attachment.html>
More information about the mei-l
mailing list