This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: XPath question


>     <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:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]