Quotes problems in XSL!!!

X

XML-hip_hip_urrah

Hallo to everybody.
I spent last two days looking for a solution to my problem. I hope in
your help.
This is the question:
I'm writing a XSL file containing HTML and Javascript code.
The problem is that some XSL values must appear inside HTML Tags as
properties value and javascript function arguments.
I.E.:

<a name="<xsl:for-each select='CATEGORY'>"
href="javascript:MyFunc('<xsl:for-each select="CATEGORY">');">

A big deal with quotes ' and "...
What the correct syntax to concatenate XSL values and HTML/JAVASCRIPT
code in a XSL file?

I hope in you!!!

Bye bye
 
J

Johannes Koch

XML-hip_hip_urrah said:
<a name="<xsl:for-each select='CATEGORY'>"
href="javascript:MyFunc('<xsl:for-each select="CATEGORY">');">

XSLT must be well-formed XML. Your syntax is not well-formed. Try
something like

<a>
<xsl:attribute name="attributeName">
<!-- some XSLT code here -->
</xsl:attribute>
</a>
 
G

Gomolyako Eduard

See below.

Your issue:

<xsl:for-each select="category">
<xsl:element name="a">
<xsl:attribute name="name">
<xsl:value-of select="." />
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="concat('javascript:MyFunc(&quot;',
string(.), '&quot;);')" />
</xsl:attribute>
</xsl:element>
</xsl:for-each>

Best, Ed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,849
Latest member
Fira

Latest Threads

Top