[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: how to set the pattern to get the node
> I am so confused that why I can use > <xsl:when test="Parent_ID=1 or > not(preceding-sibling::List[List_ID = $self/Parent_ID] > or following-sibling::List[List_ID = > $self/Parent_ID])"> > > to get node which I wnat > but when I > use > > <xsl:template match="List[Parent_ID=1or > not(preceding-sibling::List[List_ID=Parent_ID] or > following-sibling::List[List_ID=Parent_ID])]"> > > It is not filter properly > You're having trouble understanding context. Within a predicate, path expressions are evaluated relative to the node that you're testing. So List[List_ID=Parent_ID] means "find List elements whose List_ID is equal to their Parent_ID", for example <List> <List_ID>12</List_ID> <Parent_ID>12</Parent_ID> </List> If your data contained <List> <List_ID>12</List_ID> <Parent_ID>12</Parent_ID> <Parent_ID>23</Parent_ID> </List> that would be selected as well. But when you write List[List_ID=$self/Parent_ID] then you are selecting List elements whose List_ID is equal to the Parent_ID of the node held in variable $self. Michael Kay http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|