[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Filter nodelist
Hi, > I have an XML document that contains a few 'product' elements > with 'id' > attributes. Because I have to operate on these products a few times I > build a variable that just takes all products with the expression > 'descendant::product'. Sometimes I have to iterate over all products. > But that is not all I do with the list. My problem: I have to get the > count of all products from this node-list that have the same id like a > certain product in the list and that's position in the node-list is > lower. Example: > > [product id="A", > product id="B", > product id="C", > product id="B", > product id="B", <- > product id="D", > product id="E"] > > So if I have the product at position 5 the result of the > count should be > 2, because of the products at position 2 and 4 with the same id. E.g. count($theCurrentProduct/preceding::product[@id = $theCurrentProduct/@id]) but it's very inefficient. Cheer, Jarno XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|