Computing the length of a river network from the original Mondial:
From the XSLT part, it is simple. The problem is to find a suitable
algorithm that can be implemented in XSLT (the stylesheet is also not very long -
my one has 60 lines in three templates).
- possible with the common XSLT elements that have been discussed in the
lecture.
- As I already suspected in the lecture, the combination of
xsl:variable and xsl:apply-templates provides a possible solution.
- for this, have a look at the solution how to evaluate arithmetic
terms in Exercise 4.2.
- Now there are two possibilities:
- One that works also with XSLT 1.0:
- analyze what is missing to implement the same solution as for
the computation of the network length based on the recursive structure
of rivers.
- think how to replace it (by an algorithm, not by hacking!).
- the XPath part requires to use features that have been mentioned
in the lecture, but not used in the examples.
Here it is necessary first to consider carefully what should be selected and
then to look how this is expressed in XPath.
- One that works only since XSLT 2.0 (use saxon):
- create the nested structure, assign it to a variable, query the
variable (note: the variable then acts like a "let" in XQuery)