RE: XPath question

Subject: RE: XPath question
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 11 May 2000 13:32:50 +0100
>     <div type="introduction">
>     <head>Introduction</head>
>     <pb/>
>     <div type="partie">
>     <p>Test
>     </p>
>     <pb/>
>     </div>
>     </div>
> <xsl:template div[@type='introduction']">
> <xsl:for-each select="./*/pb">
> Find pb
> </xsl:for-each>
> </xsl:template>
> Why xt find only one pb.

Because there is only one <pb> element that is a grandchild of <div
type="introduction">, the other one is an immediate child. If you want to
find all descendant <pb> elements, write <xsl:for-each
select="descendant::pb">, or ".//pb" (which means the same thing unless
there are positional predicates). If you want to find children and
grandchildren, write "pb | */pb".

Mike Kay

 XSL-List info and archive:

Current Thread