untitled

(ff) #1

280 11 The XML Transformation Language


11.8 Exercises


The following exercises use the BioML example in figure 1.3. Each exercise
is solved with one or two templates that transform the kinds of elements
mentioned in the exercise. Each of the solutions is an XSLT program having
the following form:
<xsl:transform version=’1.0’
xmlns:xsl=’http://www.w3.org/1999/XSL/Transform’>

<!-- The answer to the exercise goes here. -->

<!--
This template copies all elements and attributes
that do not appear in the template(s) above.
-->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

</xsl:transform>


  1. Copy thelocusname attribute so that it is an attribute ofgene.

  2. Remove alllocuselements, and move anyreferenceelements from
    being child elements of thelocuselement to being child elements of the
    geneelement.

  3. Change the BioML example to have a striping layer betweenorganism
    andchromosomeas shown in figure 1.14.

  4. Change thereferenceelements to be eitherisStoredInorisCited
    Bydepending on whether the reference is to a sequence database or to a
    literature reference.

  5. Infer the EMBL sequence number and the organism of each gene, adding
    them to thegeneelement as attributes.

  6. For each gene, compute the total length of all exons that it contains. Com-
    pare your solution with your solution to exercise 11.8.

Free download pdf