![]() |
|
|
|||||||
![]() |
XML - expand parts of an xml, which is transformed by xslt to html |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hi!
Certainly somebody had my problem before and could give me just some hints, how to solve it: I have an xml file, which contains scientific data in a tree form. The data should be changed in a JSR168-Portlet and in a Python-Environment as well, so I want them to be parsed by an xslt to html which then could be shown in a web browser. It is quite easy to parse the tree and collapse or expand the whole tree by parsing the xml against the xslt. What I would like to be able to do, is to give the xslt an xpath (or whatever path), for example /layer/projection[@type='mercator']/longitude and the xslt parses the stylesheet so, that only this path is expanded in the resulting html. I don't like the idea of expanding the whole tree at once, reading the whole tree into the browser and make it expanding/collapsing by javascript, as I would have the whole file in the memory of the client. Would be great, if somebody could give me hints! Cheers, Sebastian sebastian.langer@gmx.de |
|
|
|
|
#2 |
|
Posts: n/a
|
Passing a completely general XPath into XSLT as a string (presumably a
stylesheet parameter) and having it executed as part of the stylesheet's evaluation requires the use of an extension function, such as the "dynamic" extensions defined by EXSLT. If your processor doesn't support such an extension (or if you want a more reliably portable solution) you could try to write an XPath interpreter in XSLT... ugh. Another solution would be to take this in stages -- use a stylesheet which takes the XPath as a parameter and uses it to insert this XPath into the appropriate place in the the selective-expansion stylesheet, then use the resulting styled stylesheet to process your actual data document. -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry |
|
|
|
#3 |
|
Posts: n/a
|
Hey!
I thought a bit about all the stuff and think, one possible solution could be to pass the xpath of the deepest expanded hierarchy-element to the stylesheet. Then I could parse the xml using an ancestor-or-self test for each element to find out, if it is an ancestor of the last expanded one and therefore if it should be visibile or not. If it is an ancestor, it will be treated as visible, otherwise as invisible. Thank you, Joe! Cheers, Sebastian |
|