too many old people The number of people is:"> too many old people The number of people is:">
Download presentation
Presentation is loading. Please wait.
1
More on XSLT
2
More on XSLT variables Earlier we saw two ways to associate a value with a variable A variable whose value is the empty string, for example A variable whose value is specified by the select attribute Examples But there is a third way, which allow greater flexibility –It involves using a non-empty xsl:variable element –The content specifies the value of the variable –We can use the full range of XSLT elements to compute the value
3
Computing a contingent value for an xsl:variable 21]) > 1"> too many old people The number of people is:
4
Computing a cumulative value for an xsl:variable The ages of the people are:
5
Computing a complex cumulative value for an xsl:variable : The ages of the people are:
6
Aside: the position() function When a sequence of items is being processed, this function return the position of the current item within the sequence This is true whether the sequence of items being processed by a –for-each element –or an apply-templates element
7
Terminating a cumulative value for an xsl:variable This program does not append a comma to the last item in the sequence, The ages of the people are:
8
Aside: the last() function When a sequence of items is being processed, this function return the position of the last item within the sequence This is true whether the sequence of items being processed by –a for-each element –or an apply-templates element
9
Terminating a cumulative value for an xsl:variable, version 2 This program uses last() to avoid placing a comma after last item in sequence, The ages of the people are:
10
Aside: templates can be used when computing values for variables We can use the full range of XSLT elements to compute the value This includes using the apply-templates element
11
Using apply-templates to compute the value for a variable 21]"/> The ages of the people over 21 are,
12
Aside: More on sorting We have seen that sort elements can be used inside for- each elements They can also be used inside apply-templates elements
13
Sorting inside an apply-templates element The ages of the sorted people are,
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.