XML - Managing Data Exchange/C.4
Jump to navigation
Jump to search
XML Style Sheet[edit | edit source]
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</xsl:template>
</xsl:stylesheet> |
Table 4-3: XML style sheet for a one-to-one relationship – country_dest.xsl
The XML style sheet in Table 4-3 introduces the if statement as well as the ability to sort elements.
The if statement executes code based on the evaluation of the condition given in the "test" attribute,e.g.
<xsl:if test="population >= 10000">
- Big Town
</xsl:if>
<xsl:if test="population < 10000">
- Small Town
</xsl:if>
Possible expressions for the condition are
Operator |
Meaning |
= | equality of two values |
!= | inequality of two values |
< | less than |
> | greater than |
<= | less than or equal |
>= | greater than or equal |
and | logical and-conjunction |
or | logical or-conjunction |
Output can be sorted based on the value of the select attribute of the <xsl:sort> element.