[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] getting javascript into an xsl variable

Subject: [xsl] getting javascript into an xsl variable
From: dan haig <haig@xxxxxxx>
Date: Tue, 28 May 2013 16:14:27 -0400


I am trying to get my XTF to read a bit of javascript into an XSL
variable. I know the drill about msxml and all that, not going there
obviously, but I wonder why this seemingly is impossible.

So, given a url:;chunk.id=eliot_p.volume01.chapter10.pdf;toc.depth=1;toc.id=;page=69;brand=default#page/68/mode/2up

...I want to be able to work with the post-hash stuff,
page/68/mode/2up in this case. I can get it to display inline with the
text via this:

<script type="text/javascript">document.write(window.location.hash);</script>

...and, failing elsewhere and grasping at straws, have at least
managed to make this also work to display inline and was hoping I
could then get at the element thru some bizarre circuitous route, as
one often must do with xslt:

 <xsl:element name="posthash"><script

...but I can't do anything with the string, can't get it into a
variable, can't manipulate it to construct a new URL (the bookreader
viewer depends on the posthash page and mode values which change as
the user reads, and I don't want them to lose state if they, for
instance, click a 'clear search hits' link). copy-of also worked to
render the string inline, but you can't make a variable out of that or
put it thru functions either it seems.

All the ink I've seen spilled out there declares it impossible to pull
javascript into an XSL variable save thru msxml. Is this still true?


Current Thread