How to embed XSL expression within an attribute?

D. Alvarado

Usenet Archive
Joined
Apr 25, 2002
Messages
63
Reaction score
0
Hello,
I am outputting HTML from an XSLT and I am having trouble setting the value of a form-action field based on certain conditions. Here is the non-working code:

<xsl:template match="dictionary-link[$no-dictionary = 'false']"> <form name="dictionaryform" method="get" action="<xsl:choose><xsl:when test="$var1=''">dictionary.jsp</xsl:when><xsl:eek:therwise>dictionary.jsp</xsl:eek:therwise></xsl:choose>" target="dictwin" onSubmit="dictwin=window.open('','dictwin','fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=300,height=400')"> <div class="dictionary-link"> <table width="100%"><tr> <td align="left" width="33%"> Look up a word </td> <td align="center" width="33%"> <input type="text" name="word" size="20"/> </td> <td align="right" width="33%"> <input type="image" alt="Go" border="0" src="gobutton.gif"/> </td> </tr></table> </div> </form> </xsl:template>

When I try and run the transform, things crash and burn because I'm told the value of the "action " attribute cannot contain "<". Can anyone suggest a work-around?

Thanks, -
 

Igor Zlatkovic

Usenet Archive
Joined
Jun 30, 2004
Messages
5
Reaction score
0
D. Alvarado said:
Hello,
I am outputting HTML from an XSLT and I am having trouble setting the value of a form-action field based on certain conditions. Here is the non-working code:

<xsl:template match="dictionary-link[$no-dictionary = 'false']"> <form name="dictionaryform" method="get" action="<xsl:choose><xsl:when test="$var1=''">dictionary.jsp</xsl:when><xsl:eek:therwise>dictionary.jsp</xsl:eek:therwise></xsl:choose>" target="dictwin" onSubmit="dictwin=window.open('','dictwin','fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=300,height=400')"> <div class="dictionary-link"> <table width="100%"><tr> <td align="left" width="33%"> Look up a word </td> <td align="center" width="33%"> <input type="text" name="word" size="20"/> </td> <td align="right" width="33%"> <input type="image" alt="Go" border="0" src="gobutton.gif"/> </td> </tr></table> </div> </form> </xsl:template>

When I try and run the transform, things crash and burn because I'm told the value of the "action " attribute cannot contain "<". Can anyone suggest a work-around?

Create the attribute with <xsl:attribute/>

http://www.w3.org/TR/xslt#element-attribute

Ciao,
Igor
 

Johannes Koch

Usenet Archive
Joined
Nov 14, 2000
Messages
801
Reaction score
0
D. Alvarado said:
When I try and run the transform, things crash and burn because I'm told the value of the "action " attribute cannot contain "<". Can anyone suggest a work-around?

<xsl:template match="dictionary-link[$no-dictionary = 'false']"> <form name="dictionaryform" method="get" ...> <xsl:attribute name="action"> <xsl:choose> <xsl:when test="$var1=''">dictionary.jsp</xsl:when> <xsl:eek:therwise>dictionary.jsp</xsl:eek:therwise> </xsl:choose> </xsl:attribute> ... </form> </xsl:template>
 

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
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top