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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL and Javascript - what is this code doing??

Status
Not open for further replies.

Nosh

Programmer
Jul 12, 2001
34
GB
Hi Folks,

I have some XML which is basically an order header made up of several lines. in my XSL I am using the following code to flag any errors and create a hypertext link that will direct the user to the field in error:

<xsl:for-each select=&quot;/OrdLine/ord_no/error_message&quot;>
<LI>
<A name=&quot;pickup_sta&quot; href=&quot;javascript:document.forms[0].pickup_sta.focus();&quot;>
<xsl:value-of select=&quot;.&quot;/>
</A>
</LI>
</xsl:for-each>

This give me the error message as a href and lets me click on it and go to the offending input on the form.

HOWEVER I cannot get this to work for the lines as there are a variable number of lines.

A friend of mine told me to try this:

<xsl:for-each select=&quot;Ord_head/ord_line&quot;>
<xsl:variable name=&quot;count&quot;>
<xsl:value-of select=&quot;position(Ord_head/ord_line)-1&quot;/>
</xsl:variable>
<xsl:for-each select=&quot;ItemId/error_message&quot;>
<LI>
<A name=&quot;itemIdE__{$count}&quot; href=&quot;javascript:document.forms[0].itemId__{$count}.focus();&quot;>
<xsl:value-of select=&quot;.&quot;/>
</A>
</LI>
</xsl:for-each>
</xsl:for-each>

This does not work. I get complaints about the javascript.

Can anybody help me please.

Cheers
Nosh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top