Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What we mean by this xsl notation <xsl:template match="/|@*|node()">

Tags:

notation

xslt

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

like image 956
Ironman Avatar asked Nov 16 '12 18:11

Ironman


People also ask

What does xsl template match mean?

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

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 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 is the use of xsl template?

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.


1 Answers

/|@*|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.

like image 131
Martin Honnen Avatar answered Sep 28 '22 05:09

Martin Honnen