?
Solved

How to escape JavaScript curly brackets in XSL

Posted on 2005-04-18
3
Medium Priority
?
2,229 Views
Last Modified: 2008-03-17
Hello, I have an XSL stylesheet that is generating HTML.   I would like to know how to escape the curly brackets in JavaScript so the XSL parser doesn't throw an error like I'm trying to use the short-cut of value-of.  Example:

<input type="text" id="txtTest" onchange="if(numericChanged(this)) { doFunction1(this); doFunction2(this); }" >
      <xsl:attribute name="value">
             <xsl:value-of select = "dataset/prospect/@test" />
      </xsl:attribute>
</input>

I am asking if there is a way to escape those curly brackets.  I do not want to have a wrapper function for the functions above.  The question is if I can somehow escape the curly brackets.  Thanks. :)

0
Comment
Question by:dentyne
  • 3
3 Comments
 
LVL 23

Expert Comment

by:b1xml2
ID: 13806515
<xsl:attribute-set name="onchange">
<xsl:attribute name="onchange">if(numericChanged(this)) { doFunction1(this); doFunction2(this); }</xsl:attribute>
</xsl:attribute-set>

<xsl:template match="...">
<input type="text" id="txtTest" use-attribute-sets="onchange" >
      <xsl:attribute name="value">
             <xsl:value-of select = "dataset/prospect/@test" />
      </xsl:attribute>
</input>
</xsl:template>
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 13806519
by using the xsl:attribute-sets, you can avoid the problem of the curly brace...
0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 1000 total points
ID: 13806917
you could also use the <xsl:attribute>

<input type="text" id="txtTest">
<xsl:attribute name="onchange">if(numericChanged(this)) { doFunction1(this); doFunction2(this); }</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select = "dataset/prospect/@test" /></xsl:attribute>
</input>
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Loops Section Overview
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question