STX styl a zpracování - příklad

Příklad převzat z Extended SAX Filter Processing with STX by Oliver Becker

Modify the input by adding a consecutive ID attribute to certain elements (footnotes that appear within chapters):

<stx:transform xmlns:stx="http://stx.sourceforge.net/2002/ns"
               xmlns:ex="http://www.example.com/"
               version="1.0" pass-through="all">
  <stx:variable name="count" select="1" />
  <stx:template match="chapter//footnote">
    <stx:copy attributes="@*">
      <stx:attribute name="ex:id" select="$count" />
      <stx:assign name="count" select="$count + 1" />
      <stx:process-children />
    </stx:copy>
  </stx:template>
</stx:transform>