怎么介绍?
分类:
2008-11-30 14:38:28
The xsl:value-of
element should only be used
in contexts where it is obvious which node's value is being taken. If
there are multiple possible items that could be selected, then only the
first one will be chosen. For instance, this is a poor rule because a
typical PERIODIC_TABLE
element contains more than one ATOM
:
There are two ways of processing multiple elements in turn. The first method you've already seen. Simply use xsl:apply-templates
with a select
attribute that chooses the particular elements that you want to include, like this:
The select="."
in the second template tells the formatter to take the value of the matched element, ATOM
in this example.
The second option is xsl:for-each
. The xsl:for-each
element processes each element chosen by its select
attribute in turn. However, no additional template is required. For example: