Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - expand parts of an xml, which is transformed by xslt to html

 
Thread Tools Search this Thread
Old 07-20-2006, 01:30 AM   #1
Default expand parts of an xml, which is transformed by xslt to html


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
  Reply With Quote
Old 07-20-2006, 04:15 AM   #2
Joe Kesselman
 
Posts: n/a
Default Re: expand parts of an xml, which is transformed by xslt to html

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
  Reply With Quote
Old 07-20-2006, 07:51 AM   #3
sebastian.langer@gmx.de
 
Posts: n/a
Default Re: expand parts of an xml, which is transformed by xslt to html

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

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump