[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Complex transform + adding an incremental integer to a
Hello list, I have been trying to create a list of nodes containing sometimes the parent and sometimes the childs depending on a "selected" attribute (but then not keeping the parent). While keeping the order the nodes came from. + adding an "order" attribute which is an incremental integer. Which would give: Input XML -> Output XML <n1 id=1> -> <newNode order=1>...</newNode> <n2 id=1 selected=0>...</n2> <n2 id=2 selected=0>...</n2> </n1> <n1 id=2> -> this one is not kept as we will keep some of the childs <n2 id=1 selected=1>...</n2> -> <newNode order=2>...</newNode> <n2 id=2 selected=0>...</n2> <n2 id=3 selected=1>...</n2> -> <newNode order=3>...</newNode> </n1> <n1 id=3> -> <newNode order=4>...</newNode> <n2 id=1 selected=0>...</n2> <n2 id=2 selected=0>...</n2> </n1> I tried to do a template select to return all the wanted nodes and then use position() to feed the order attribute, but by using the operator | I ended up with first all the nodes coming from n1 and then all the nodes coming from n2, which is not the order I want them. And also the node <n1 id=1> would be transferred although its childs are transferred. It is a bit of a dual problem because of this order attribute, which is incremental... I would be happy with any clue/quidelines/ideas. Although I am not sure if my explanations are very clear. Anyway, I thought of a backup solution of using two xsl transform, one to get all the nodes I want in the correct order, and an other xslt to fill the order attribute using position() Thank you for your time Mathieu Sagot
|
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
|