xsl-list
[Top] [All Lists]

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

2005-09-21 02:16:24
Put it in curly braces { }

eg href="blah.location={$testvar}"
                                 ^           ^
or build the attribute:

<xsl:attribute name="href">
  <xsl:text>location=</xsl:text>
  <xsl:value-of select="$testvar"/>
</xsl:attribute>

Some other points about your post:

- are you intending to transform client side?  If so you can only use XSLT 1.0
- never use notepad!  It will break you eventually... there are plenty
of XSLT editors out there and even more XML editors, any of those are
better than notepad.


On 9/21/05, andrew(_at_)rarebird(_dot_)u-net(_dot_)com 
<andrew(_at_)rarebird(_dot_)u-net(_dot_)com> wrote:
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.

Andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--