I dont understand what we mean by this..
<xsl:template match="/|@*|node()">
<xsl:apply-templates match="@*|node()"/>
</xsl:template>
Please help me out..
<xsl:template match="local-name()='status'"/>
<xsl:template match="/|@*|node()">
<xsl:copy>
<xsl:apply-templates match="@*|node()"/>
<xsl:copy>
</xsl:template>
If i apply like this it is omitting the <status>
node in my xml,howz it happening
XSLT <xsl:template> The match attribute is used to associate the template with an XML element. The match attribute can also be used to define a template for a whole branch of the XML document (i.e. match="/" defines the whole document).
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.
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 of XSLT Template. XSLT Template defines a way to set rules to generate the desired Output in a proper structure for a particular context and to build a template. The template tells the XSLT processor how to format a particular output from the XML source document.
/|@*|node()
is a match pattern composed of three single patterns. /
matches a root node, also called document node, @*
matches any attribute node and node()
as a pattern "matches any node other than an attribute node and the root node". So for any kind of node (as those three patterns describe all types of nodes) the template says <xsl:apply-templates select="@*|node()"/>
which means process the union of the attribute nodes and the child nodes. Document nodes matched by /
don't have attribute nodes and attributes don't have them either but as a compact way you often see templates like that.
However there is a built-in template for document nodes that does <xsl:template match="/"><xsl:apply-templates/></xsl:template>
so usually people omit the /
in the pattern.
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