Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

links in a combo-box with xslt

Status
Not open for further replies.

bateman23

Programmer
Joined
Mar 2, 2001
Messages
145
Location
DE
Hi,
i'm trying to fill an html-combobox within a xslt-stylesheet. My Code actually looks like this, but i can't get things working...
Code:
<form name="docform" >
 <xsl:element name="select">
   <xsl:attribute name="name">selModelle</xsl:attribute>
   <xsl:attribute name="id">selModelle</xsl:attribute>

   <xsl:for-each select="/java/object/void/string">
    <xsl:element name="option">
     <xsl:attribute name="value"> 
      <xsl:text>[URL unfurl="true"]http://www.google.com/</xsl:text>[/URL]
     </xsl:attribute>
     <xsl:value-of select="."/>
    </xsl:element>
  </xsl:for-each>
 </xsl:element>

<input type="button" value="Go"  onClick="jumptolink(document.docform.selModelle.selectedIndex)"/><br/>
</form>
Any ideas?

---------------------------------------
Visit me @:
 
ok, solved my problem: i forgot ;) that xalan (or any other xslt-processor) just ignores the <!-- --> tags. So in the html-output file the java-script was missing.
i used the following code, which didn't work:
Code:
<script type="text/javascript">
<!--
 function jumptolink(what){
 var selectedopt=document.docform.selModelle.options[what]
 if (document.getElementById && selectedopt.getAttribute("target")=="newwin")
    window.open(selectedopt.value)
 else
    window.location=selectedopt.value
 }
-->
</script>
Here's the working code-part of the xslt-file, which creates the javascript:
Code:
<script type="text/javascript">
<xsl:comment>
 function jumptolink(what){
 var selectedopt=document.docform.selModelle.options[what]
 if (document.getElementById &amp;&amp; selectedopt.getAttribute("target")=="newwin")
    window.open(selectedopt.value)
 else
    window.location=selectedopt.value
 }
</xsl:comment>
</script>

---------------------------------------
Visit me @:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top