<generation xmlns="http://hl7.org/fhir" value="html"/> <page xmlns="http://hl7.org/fhir"> <xsl:apply-templates select="@*|node()[not(self::f:page)]"/> </page> <xsl:apply-templates select="f:page"/> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="$artifactsOnRoot='true'"> <xsl:call-template name="artifactPages"/> </xsl:when> <xsl:otherwise> <xsl:if test="not(descendant-or-self::f:page[f:nameUrl/@value='artifacts.html'])"> <page xmlns="http://hl7.org/fhir"> <nameUrl value="artifacts.html"/> <title value="Artifacts Summary"/> <generation value="html"/> <xsl:call-template name="artifactPages"/> </page> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:copy> </xsl:template> <xsl:template match="f:page[f:nameUrl/@value='artifacts.html']"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> <xsl:if test="not($artifactsOnRoot='true')"> <xsl:call-template name="artifactPages"/> </xsl:if> </xsl:copy> </xsl:template> <xsl:template name="artifactPages"> <xsl:for-each select="/f:ImplementationGuide/f:definition/f:grouping"> <xsl:if test="not(following-sibling::f:grouping[@id=current()/@id])"> <xsl:for-each select="parent::f:definition/f:resource[f:extension[@url='http://hl7.org/fhir/StructureDefinition/implementationguide-page']][f:groupingId/@value=current()/@id]"> <xsl:variable name="id" select="substring-after(f:reference/f:reference/@value, '/')"/> <page xmlns="http://hl7.org/fhir"> <nameUrl value="{f:extension[@url='http://hl7.org/fhir/StructureDefinition/implementationguide-page']/f:valueUri/@value}"/> <title value="{f:name/@value}"/> <generation value="generated"/> <xsl:for-each select="f:extension[@url='http://hl7.org/fhir/tools/StructureDefinition/contained-resource-information']"> <page xmlns="http://hl7.org/fhir"> <xsl:variable name="url" select="concat(f:extension[@url='type']/f:valueCode/@value, '-', $id, '_', f:extension[@url='id']/f:valueId/@value, '.html')"/> <nameUrl value="{$url}"/> <xsl:for-each select="f:extension[@url='title']/f:valueString"> <title value="{@value}"/> </xsl:for-each> <generation value="generated"/> </page> </xsl:for-each> </page> </xsl:for-each> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>