mikey
mikey

Reputation: 1460

XSLT match a element that has a specific parent

I am quite new to XSLT, and I am trying to learn Xpath.

Let's suppose I have match="warning/para" and the XML file I want to analyze is:

<para>A normal paragraph.</para>
 <warning>
    <para>Warning paragraph one.</para>
    <para>Warning paragraph two.</para>
  </warning>
<para>Another normal paragraph.</para>

The matched <para> elements are just the one inside the <warning> element, or the <para> outside the warning element are matched as well?

Upvotes: 1

Views: 269

Answers (1)

ppetrid
ppetrid

Reputation: 3845

A single '/' means a direct descendant, so the engine expects a 'para' element inside a 'warning' element. Therefore only the nested para elements are matched.

Upvotes: 1

Related Questions