Re: XSLT Q&A: Refactoring templates

In XSLT 2.0 I think this can be made even shorter with max():

<xsl:template match="section/title">
  <xsl:element name="h{max(6, count(ancestor::section) + 1)}">
    <xsl:apply-templates />
  </xsl:element>
</xsl:template>

I like compact code. ;-)

Reply

The content of this field is kept private and will not be shown publicly.