390 17 Answers to Selected Exercises
Note that the attributes oforganismremain in the same element, but the
child elements oforganismare made child elements of the newcontains
ANSWER TO element.
EXERCISE11.4
<xsl:template match="reference">
<xsl:choose>
<xsl:when test="@name=’Sequence databases’">
<isStoredIn>
<xsl:apply-templates select="@*|node()"/>
</isStoredIn>
</xsl:when>
<xsl:when test="@name=’Literature references’">
<isCitedBy>
<xsl:apply-templates select="@*|node()"/>
</isCitedBy>
</xsl:when>
</xsl:choose>
</xsl:template>
ANSWER TO
EXERCISE11.5
<xsl:template match="gene">
<gene>
<xsl:attribute name="embl">
<xsl:value-of select=
"../reference[@name=’Sequence databases’]
/db_entry[@name=’EMBL sequence’]/@entry"/>
</xsl:attribute>
<xsl:attribute name="organism">
<xsl:value-of select="../../../../organism/@name"/>
</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</gene>
</xsl:template>
ANSWER TO
EXERCISE11.6
<xsl:template match="gene">
<gene>
<xsl:attribute name="totalExonLength">
<xsl:value-of