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

Discussion in 'XML' started by sebastian.langer@gmx.de, Jul 20, 2006.

  1. Guest


    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
    , Jul 20, 2006
    1. Advertisements

  2. 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
    Joe Kesselman, Jul 20, 2006
    1. Advertisements

  3. Guest


    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
    , Jul 20, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TkFsbGVu?=

    Export transformed XML to Excel

    =?Utf-8?B?TkFsbGVu?=, Jun 1, 2004, in forum: ASP .Net
    Jun 1, 2004
  2. Philipp Reiss
    Manuel Collado
    May 11, 2006
  3. bprimuslevy
    Soren Kuula
    Aug 23, 2006
  4. Curious
    Feb 14, 2004

Share This Page