I am trying to solve a problem transferring musical information between two high end scoring programs using the industry standard MusicXML language. Although the majority (say 95%) of information is transferred correctly the remainder does not because the originating program gives a general classification of <words> in the file whilst the receiving program has a more sophisticated breakdown of the information. Rather than classifying it incorrectly it doesn't translate the information at all. The information occurs randomly throughout the score rather than in a regular pattern.
What I am trying to do is read the MusicXML file and list the <words> where they occur together with the part identification and measure (bar) number to enable me to add the information manually at a later stage. I have come across BaseX while researching how to parse the files but am struggling to master the logic of xquery to achieve my aim.
The structure of the file at my interest level is:-
<!--============== Part: P2, Measure: 27 ==============--> <measure number="27" width="224"> <direction> <direction-type> <words default-x="9" default-y="20" justify="left" valign="middle" font-family="Times New Roman" font-style="normal" font-size="5.9683" font-weight="normal">tutti</words>
and my xquery entries are:-
let $score := doc('score')/score-partwise(:/part/measure/direction/direction-type/words:)
for $word in ($score//words/text()) let $p := $score/part/@id let $m := $score/part/measure/@number
return $word, $p, $m
If I return just $word I get the relevant <words>entries but if I add $p and $m I get an error message 'undeclared variable $p'
I realise that this is more of an xquery question than BaseX but I thought I would come here first.
Any help would be greatly appreciated.
Joe Curtis
.
basex-talk@mailman.uni-konstanz.de