This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Pop-up window


Hi all,
	My problem is fairly straight-forward.  I have a bibliography
database in xml that is displayed as a list of publications using
xsl.  "Abstract" is one of the fields contained in each entry.  Here is a
sample entry:

<bibitem type="inproceedings">
    <author URL="http://www.cs.utah.edu/~whitaker/";>R. Whitaker</author>
    <booktitle>Fifth
International Conference on Computer Vision '95</booktitle>
    <keywords>Deformable Models</keywords>    
    <month>June</month>
    <note>(full paper, peer review)</note>
    <pages>822--827</pages>
    <title>Algorithms for implicit deformable models</title>
    <year>1995</year>
    <abstract>&lt;p&gt;This paper presents a framework for implicit
deformable models and a pair of new algorithms for solving the nonlinear
partial differential equations that result from this framework. Implicit
models offer a useful alternative to parametric models, particularly when
dealing with the deformation of higher-dimensional objects. The basic
expressions for the evolution of implicit models are relatively
straightforward; they follow as a direct consequence of the chain rule for
differentiation. More challenging, however, is the development of
algorithms that are stable and efficient. 

&lt;p&gt;The first algorithm is a viscosity approximation which gives
solutions over a dense set in the range, providing a means of calculating
the solutions of embedded families of contours simultaneously. The second
algorithm incorporates sparse solutions for a discrete set of
contours. This sparse-field method requires a fraction of the computation
compared to the first but offers solutions only for a finite number of
contours. Results from 3d medical data as well as video images are shown. 
    </abstract>
</bibitem>

I have the abstract displayed as a link and I want the user to be able to
click on the abstract for any publication and see a pop-up window
containing the abstract and other related information.

The problem with using a regular javasript pop-up window is that I
don't want to refer to a different URL; I want to display the current
values in the current node and I would lose that information if I referred
to a new URL.  The option that seems best is the pass the current element
values as parameters to a javascript function, then build the content for
the pop-up window in the javascript itself.  The javascript looks like
this:


function subWrite(thisAbstract, author, month, year, title, journal,
editor, volume, number, pages, publisher){
  makeNewWindow();
  newWindow.focus();
  var newContent = "<html><head><title>Abstract</title></head>";
  newContent += "<body><h1>Abstract</h1>";
  newContent += thisAbstract;   
  newContent += "</body></html>";
  newWindow.document.write(newContent);
  newWindow.document.close();
}    


The function call in the xsl looks like this:

<a href="javascript:subWrite('{$thisAbstract}', '{$author}', '{$month}',
'{$year}', '{$title}', '{$journal}', '{$editor}', '{$volume}',
'{$number}', '{$pages}', '{$publisher}')">Abstract</a>


This works fine as long as there are no single or double quotes in the
variables being passes as parameters.  In other words, if the abstract
contains a quotation mark somewhere (and many do), the xsl interprets the
quote as if it is the end of the function call instead of just
ignoring it as part of the text. 

Is there a way to pass xsl element values (values which change depending 
on context) to a javascript function without having the xsl try to parse
the values in the process?  

Also, is there a better way to create a pop-up window to display
values from current nodes in xsl?  I hope this made sense.  Thanks in
advance.  

Jenny Simpson
Sci Institute  


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]