[xsl] Passing an XSLT variable into a <a name="Ixxx" href="javascript:location= line.

Subject: [xsl] Passing an XSLT variable into a <a name="Ixxx" href="javascript:location= line.
From: andrew@xxxxxxxxxxxxxxxxxx
Date: Wed, 21 Sep 2005 10:05:24 +0100
Please forgive me if this posted twice ... I had a powercut as I hit send earlier.

I am a real newbie to XSLT, creating a simple proof of concept application so that my employers might see the value of transforming and presenting some XML from a very large Excel spreadsheet.

I am using notepad as the editor and the application is check in and will be displayed in Microsoft Internet Explorer 6. (MSXML). I am attempting to use XSLT 2.0 as described in Dr Tennison's book.

For the demo, the application has three frames controlled by a menu in one frame. The menu, and other documents, are created by transforming XML pulled from Excel. Bookmark is a field in the Excel that exists in each mode of the XML. The creation of textvar works as I wish (xsl:value-of demonstrates this to me).

The pertinent code extract is ...


<xsl:variable name ="testvar" select="concat('Section_1#',Bookmark)" as= "xs:string" />

<a name="Introduction" href="javascript:location='#Introduction'; parent.main_body.location=$testvar; parent.right_side.location='section_1_tools.xml'"> <img src="Bullets/SmallBlueBullet.gif" align="absmiddle" border ="0" alt="{string(Heading2)}" /> </a>


My problem is with having testvar read as "Section_1#Intro" (if Bookmark for this node was "Intro"). No matter how I try to place it - quotes, with / without $ etc, is is always read as a literal and the changes in the other frame just don't happen as desired.

I have examined the archive and cannot find a solution (but my lack f skill may mean I missed an obvious analogue).

I am truely stumped - I know how to escape in a <script> </script> code block, but this situation is different.

Your help greatly appreciated.


Current Thread