RE: [xsl] accumulator needed

Subject: RE: [xsl] accumulator needed
From: Jarno.Elovirta@xxxxxxxxx
Date: Fri, 6 Jul 2001 08:17:03 +0300
Hip hei!

>   <!-- Draw a quarter note. -->
>   <xsl:template match="note">

You need to declare the parameters used here, i.e. 

  <xsl:param name="x_offset" select="0">
  <xsl:param name="y_offset" select="0">

>     <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="";>
>      <xsl:text>MusicGlyphs.svg#BLACKHEAD</xsl:text>
>    </xsl:attribute>
>  </xsl:element>
>       </xsl:element>
>     </xsl:if>
>   </xsl:template>

You could make the accumulator thingy to work by either counting the
durations of previous notes with something like


which wouldn't actually accumulate anything, but would get the job done; or,
you could process the notes by first selecting only the first one and then
in the template for "note" continue by select the following-sibling::note
with the offset parameter.

Hope this helps,


 XSL-List info and archive:

Current Thread