XSLT Logic Elements
| Node | Description/ attributes | Container/ children | Example |
|---|---|---|---|
| xsl:apply-templates | Specifies that other matches may exist within that node; if this is not specified any matches will be ignored
If “select” is specified, only the templates that specify a “match” that fits the selected node or attribute type will be applied, i.e. the matching elements by "select" attribute in apply-templates corresponding to the template that match the same elements . If “mode” is specified, only the templates that have the same “mode” and have an appropriate “match” will be applied |
Any parent Can contain any number of xsl:sort and xsl:with-param children |
|
|
xsl:choose |
Multiple choices No attributes |
Any parent Contains xsl:when blocks and up to one xsl:otherwise block |
… |
|
xsl:for-each |
Creates a loop which repeats for every match
“select” designates the match criteria |
Any parent Can contain any XML |
|
|
xsl:if |
Yes or No conditions
“test” specifies criteria for entering the if |
Any parent Can contain any XML |
… |
|
xsl:otherwise |
The default choice if none of the “xsl:when” criteria are met | xsl:choose Can contain any XML |
… |
|
xsl:stylesheet |
Top-level element. Occurs only once in a stylesheet document.
“version” specifies which XSLT version is being used “xmlns:xsl” specifies the URL of that standard |
Top-level element. Contains all XML | … |
|
xsl:template |
Specifies processing templates “match” is when the template should be used. |
xsl:stylesheet Can contain any XML |
… |
|
xsl:variable |
Allows a variable to be declared
“name” is the variable name. It can be referred to later with “$name” |
Any parent no children |
|
|
xsl:when |
Yes or No conditions
“test” specifies criteria for entering the if |
xsl:choose
Can contain any XML |
… |
Read more about this topic: XSLT Elements
Famous quotes containing the words logic and/or elements:
“Somebody who should have been born
is gone.
Yes, woman, such logic will lead
to loss without death. Or say what you meant,
you coward . . . this baby that I bleed.”
—Anne Sexton (19281974)
“The Laws of Nature are just, but terrible. There is no weak mercy in them. Cause and consequence are inseparable and inevitable. The elements have no forbearance. The fire burns, the water drowns, the air consumes, the earth buries. And perhaps it would be well for our race if the punishment of crimes against the Laws of Man were as inevitable as the punishment of crimes against the Laws of Naturewere Man as unerring in his judgments as Nature.”
—Henry Wadsworth Longfellow (18071882)