xsl-list
[Top] [All Lists]

Re: [xsl] String concatenation inside open tag

2007-02-27 07:38:16
Jason Solan wrote:

How my initial thought to handle it is:
If there is a javascript function for this column I would output:
<a href="javascript:void(0)"

I would then add the onclick event for the function name:
onclick="javascript:myFunction(

I think I can handle that part.

The problem comes in because I don't know how to parse the parameters.
I'm in an open "<a" tag so I can't do (unless I'm mistaken) an
xsl:for-each (which is how I would normally handle this situation).

Your stylesheet is a well-formed XML document so you can't never have something like an incomplete tag e.g.
  <a href="javascript:void(0)"
in there, instead you would have e.g.
  <a href="javascript:void(0)">
and then inside of that you could create further attributes with xsl:attribute e.g.
     <xsl:attribute name="onclick">
       <xsl:text>myFunction(</xsl:text>
       <xsl:for-each select="parameters/param">
         <xsl:text>'</xsl:text>
         <xsl:value-of select="."/>
         <xsl:text>'</xsl:text>
         <xsl:if test="position() != last()">
           <xsl:text>,</xsl:text>
         </xsl:if>
       </xsl:for-each>
       <xsl:text>); return false;</xsl:text>
     </xs:attribute>
Then here you could create further attributes if needed and finally include the contents of the a element
     <xsl:text>Bar</xsl:text>
   </a>

--

        Martin Honnen
        http://JavaScript.FAQTs.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>
--~--

<Prev in Thread] Current Thread [Next in Thread>