<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pf="http://www.daisy.org/ns/pipeline/functions" version="2.0" xpath-default-namespace="" exclude-result-prefixes="#all"> <xsl:import href="http://www.daisy.org/pipeline/modules/smil-utils/clock-functions.xsl"/> <xsl:param name="ncc-totalTime"/> <xsl:template match="/*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:attribute name="calculated-totalTime" select="sum(*/number(@calculated-duration))"/> <xsl:attribute name="ncc-meta-totalTime" select="pf:smil-clock-value-to-seconds($ncc-totalTime)"/> <xsl:for-each select="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:attribute name="calculated-totalTime" select="sum(preceding::*/number(@calculated-duration))"/> <xsl:copy-of select="node()"/> </xsl:copy> </xsl:for-each> </xsl:copy> </xsl:template> </xsl:stylesheet>