This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

accumulator needed



Hello,

I'm trying to generate a SVG file from a MusicXML file, using a XSLT
stylesheet.
I need to compute my x_offset depending on the duration of the previous
notes.
In other words, I need an accumulator.
I tried to use an xsl:variable, but I learnt it's not updateable...
I need a true variable, or is there an other way?
Any suggestion is welcome. :-)

Karim Barkati



<!-- Draw notes. -->
<xsl:for-each select="note">
 <xsl:apply-templates select=".">
 <xsl:with-param name="x_offset" select="$LEFT_MARGIN + 10">
 </xsl:with-param>
 <xsl:with-param name="y_offset" select="$TOP_MARGIN + $HEADER_SIZE +
(($measure_number - 1) * ($SYSTEM_SPACING + (4 *
$STAFF_LINE_SPACING)))">
 </xsl:with-param>
 </xsl:apply-templates>
</xsl:for-each>

...

  <!-- Draw a quarter note. -->
  <xsl:template match="note">
    <xsl:if test="type='quarter'">
      <xsl:element name="g">
 <xsl:attribute name="transform">
   <xsl:text>translate(</xsl:text>
   <xsl:value-of select="$x_offset"></xsl:value-of>
   <xsl:text>,</xsl:text>
   <xsl:value-of select="$y_offset"></xsl:value-of>
   <xsl:text>)</xsl:text>
 </xsl:attribute>

 <xsl:element name="use">
   <xsl:attribute name="xlink:href"
namespace="http://www.w3.org/1999/xlink";>
     <xsl:text>MusicGlyphs.svg#BLACKHEAD</xsl:text>
   </xsl:attribute>
 </xsl:element>
      </xsl:element>
    </xsl:if>
  </xsl:template>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]