OptimizeChoose
class OptimizeChoose extends AbstractChooseOptimization
Constants
XMLNS_XSL |
XSL namespace |
Properties
protected Document | $ownerDocument | from AbstractNormalization | |
protected array | $queries | {@inheritdoc} | from AbstractChooseOptimization |
protected Element | $choose | from AbstractChooseOptimization |
Methods
Apply this normalization rule to given template
Create an xsl:text element or a text node in current template
Retrieve a list of attributes from given element
Return a list the xsl:when and xsl:otherwise children of current xsl:choose element
Test whether current xsl:choose element has an xsl:otherwise child
Test whether current xsl:choose element has no content besides xsl:when and xsl:otherwise
Test whether two elements have the same start tag
Optimize the current xsl:choose element
Test whether all branches of current xsl:choose element share a common firstChild/lastChild
Test whether all branches of current xsl:choose element have a single child with the same start tag
Move the firstChild of each branch before current xsl:choose
Move the lastChild of each branch after current xsl:choose
Optimize current xsl:choose by moving out the first child of each branch if they match
Optimize current xsl:choose by moving out the last child of each branch if they match
Optimize current xsl:choose by moving out only child of each branch if they match
Switch the logic of an xsl:otherwise if the only other branch is empty
Optimize away the xsl:otherwise child of current xsl:choose if it's empty
Replace current xsl:choose with xsl:if if it has only one branch
Reorder the current xsl:choose tree to make it a child of the first child of its first branch
Details
in
AbstractNormalization at line 40
void
normalize(Element $template)
Apply this normalization rule to given template
in
AbstractNormalization at line 57
protected Text
createPolymorphicText(string $textContent)
Create an xsl:text element or a text node in current template
in
AbstractNormalization at line 69
protected array
getNodes()
Query and return a list of nodes of interest
in
AbstractNormalization at line 83
protected bool
isXsl(DOMNode $node, string $localName = null)
Test whether given node is an XSL element
in
AbstractNormalization at line 94
protected string
lowercase(string $str)
Make an ASCII string lowercase
in
AbstractNormalization at line 99
protected void
normalizeAttribute(Attr $attribute)
No description
in
AbstractNormalization at line 103
protected void
normalizeCdataSection(CdataSection $comment)
No description
in
AbstractNormalization at line 107
protected void
normalizeComment(Comment $comment)
No description
in
AbstractChooseOptimization at line 87
protected void
normalizeElement(Element $element)
No description
in
AbstractNormalization at line 115
protected void
normalizeNode(DOMNode $node)
No description
in
AbstractNormalization at line 139
protected void
normalizeText(Text $node)
No description
in
AbstractChooseOptimization at line 103
protected void
reset()
Reset this instance's properties after usage
in
AbstractChooseOptimization at line 30
protected array
getAttributes(Element $element)
Retrieve a list of attributes from given element
in
AbstractChooseOptimization at line 47
protected array
getBranches()
Return a list the xsl:when and xsl:otherwise children of current xsl:choose element
in
AbstractChooseOptimization at line 57
protected bool
hasOtherwise()
Test whether current xsl:choose element has an xsl:otherwise child
in
AbstractChooseOptimization at line 67
protected bool
isEmpty()
Test whether current xsl:choose element has no content besides xsl:when and xsl:otherwise
in
AbstractChooseOptimization at line 79
protected bool
isEqualTag(Element $el1, Element $el2)
Test whether two elements have the same start tag
at line 108
protected void
optimizeChoose()
Optimize the current xsl:choose element
at line 20
protected bool
matchBranches(string $childType)
Test whether all branches of current xsl:choose element share a common firstChild/lastChild
at line 45
protected bool
matchOnlyChild()
Test whether all branches of current xsl:choose element have a single child with the same start tag
at line 80
protected void
moveFirstChildBefore()
Move the firstChild of each branch before current xsl:choose
at line 95
protected void
moveLastChildAfter()
Move the lastChild of each branch after current xsl:choose
at line 133
protected void
optimizeCommonFirstChild()
Optimize current xsl:choose by moving out the first child of each branch if they match
at line 146
protected void
optimizeCommonLastChild()
Optimize current xsl:choose by moving out the last child of each branch if they match
at line 162
protected void
optimizeCommonOnlyChild()
Optimize current xsl:choose by moving out only child of each branch if they match
This will reorder xsl:choose/xsl:when/div into div/xsl:choose/xsl:when if every branch has the same only child (excluding the child's own descendants)
at line 175
protected void
optimizeEmptyBranch()
Switch the logic of an xsl:otherwise if the only other branch is empty
at line 196
protected void
optimizeEmptyOtherwise()
Optimize away the xsl:otherwise child of current xsl:choose if it's empty
at line 210
protected void
optimizeSingleBranch()
Replace current xsl:choose with xsl:if if it has only one branch
at line 229
protected void
reparentChild()
Reorder the current xsl:choose tree to make it a child of the first child of its first branch
This will reorder xsl:choose/xsl:when/div into div/xsl:choose/xsl:when