Subject: [xsl] immediate preceding node within nested tags From: andy@xxxxxxxx Date: Wed, 12 Nov 2003 11:12:13 -0500 (EST) |
Hi, I have a hierarchical structure where every q-tag maps to a row in an html-table. Only when a node is on the same level (indentation) as the previous node, I don't want to start a new row. It just needs to be in the same row but on a new line using <br> So I have an XML similar to the one below (never checked well-formedness); key-attributes are NOT part of the real XML I use. I just added them in this example so I can reference them in the explanation that follows the XML: <a> <q key="a"> <y/> <q key="b"> <b> <q key="c"> <x/> <q key="d"/> <q key="e"> <f> </q> <q key="f"/> <q key="g"/> </q> <q key="h"> <j/> <q key="i"/> <q key="j"/> </q> </q> </q> </a> In the XSLT that I use, I open an html-table when the root tag matches. After that, I open a <tr> for every q-tag that matches. However, since the q's with key="f" and key="g" are on the same level (if you look at them from top to bottom) I want them to be in the same row separated by a <br>. The same goes for key="i" and key="j".Therefore I must be able to find the immediate preceding q-node, which is not necessarily a sibling. I mean that the XSLT-function I'd like to write should return <q key="i"> when I call it with <q key="j">, and it should return <q key="h"> if I call it with <q key="i">. Similarly: h should return g, g should return f, etc. etc. Hoping to make things even more clear: I don't want "d" if I call the function with "f", but I want the <q key="e">. I tried to use preceding and preceding-sibling, and stuff like that, but to no avail... It'd be great if somebody could point me in the right direction... Thanx, Andy. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XMI to XSD, Ricardo Saraiva | Thread | [xsl] Last Call Working Drafts publ, Michael Kay |
Re: [xsl] simple question: <fo: and, Barry van Weldam | Date | [xsl] Last Call Working Drafts publ, Michael Kay |
Month |