When using XSL what is the difference between
<xsl:apply-templates select="./*"/>
and
<xsl:apply-templates />
The former does not appear to bring in any text after a child element.
XSLT apply-templates define how to find elements and help in removing unwanted text in the document. It applies a template rule to the current child nodes. It adds a select attribute along with the template to specify the order of child nodes to process the current task with the help of the XSLT processor.
Definition and Usage The <xsl:apply-templates> element applies a template to the current element or to the current element's child nodes. If we add a select attribute to the <xsl:apply-templates> element it will process only the child element that matches the value of the attribute.
With <xsl:apply-templates> the current node moves on with every iteration, whereas <xsl:call-template> does not change the current node. I.e. the . within a called template refers to the same node as the . in the calling template.
Definition and Usage The <xsl:value-of> element extracts the value of a selected node. The <xsl:value-of> element can be used to select the value of an XML element and add it to the output.
Correct. "*"
or "./*"
selects the child elements of the context node. But "node()"
or "./node()"
selects all the children including elements, text nodes, comments, and processing instructions. The default for xsl:apply-templates is select="node()".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With