Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between <xsl:apply-templates select="./*"/> and <xsl:apply-templates />

Tags:

xslt

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.

like image 798
joe Avatar asked Oct 07 '11 19:10

joe


People also ask

What is xsl apply templates select () />?

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.

What does xsl apply templates select * /> mean?

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.

What is the difference between call template and apply template in XSLT?

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.

What does xsl value of select /> mean in an xsl file?

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.


1 Answers

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()".

like image 84
Michael Kay Avatar answered Oct 05 '22 23:10

Michael Kay