Sridhar Adurthi
Sridhar Adurthi

Reputation: 141

XSL Template match Syntax

I am learning XSLT templates. If there is a syntax like below, what does it mean?

<xsl:template match="xyz:abc/xyz:def"/>

Does it mean that XYZ is a root and ABC is child? in that case why we need to use "/" and again XYZ?

Can anyone clarify me? Thanks in anticipation.

Upvotes: 2

Views: 294

Answers (2)

Michael Kay
Michael Kay

Reputation: 163615

Firstly, it's just two names: match="PPP/CCC", so it matches any element whose name is CCC provided that its parent element is named PPP.

Secondly, these names happen to be qualified names. They are in the form xyz:abc, meaning that the local name must be abc, and the namespace must be the namespace URI associated with the prefix xyz.

Upvotes: 1

Darrel Miller
Darrel Miller

Reputation: 142242

It means, the element def who is a child of element abc where both elements belong to the namespace prefixed with xyz.

Upvotes: 2

Related Questions