Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > expand parts of an xml, which is transformed by xslt to html

Thread Tools

expand parts of an xml, which is transformed by xslt to html
Posts: n/a

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

Reply With Quote
Joe Kesselman
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

() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Reply With Quote
Posts: n/a

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

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT Newbie: Attribute Value transformed to Attribute Name bprimuslevy XML 1 08-23-2006 09:56 PM
one XMF file transformed by different XSLT-files Philipp Reiss XML 4 05-11-2006 11:50 AM
Non-english text getting transformed. AC ASP .Net 8 02-26-2004 02:13 PM
Script to get XSLT-transformed XML data into JS object Curious Javascript 4 02-14-2004 01:14 AM
Parts parts....PARTS!!! ARGHHH dstvns A+ Certification 8 01-07-2004 07:57 PM