Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: javascipt in xsl not working [Thread Next] Re: javascipt in xsl not workingTo: NULL Date: 5/9/2006 10:40:00 AM
<nx.nine@g...> wrote in message
news:1147132231.563279.290000@j......
> "I don't know it
> this helps, but I can't think of a reason to include executable code
> in a transform that goes into an already-running page with scripts
> already loaded."
>
> if you look in my xsl above, you notice that i generate html elements
> with ID's based on the xml attribute "id", and that onclick they
> trigger hyLink().
>
> hyLink is a function that hides a set of div's based on id, then
> displays the elements that are passed to it as arguements.
>
> function hyLink(){
> var hyArgv = hyLink.arguments;
> var hyArgc = hyArgv.length;
>
> <xsl:for-each select="//ec:ml/panel">
> document.getElementById('addr<xsl:value-of
> select="@id"/>Bod').style.display='none';
> document.getElementById('addr<xsl:value-of
> select="@id"/>View').style.display='none';
> document.getElementById('addr<xsl:value-of
> select="@id"/>Sel').style.display='none';
> <xsl:if test="child::tab!=''">
> <xsl:for-each select="tab">
> document.getElementById('addr<xsl:value-of
> select="@name"/>Con').style.display='none';
> </xsl:for-each>
> </xsl:if>
> <xsl:if test="not(child::tab!='')">
> document.getElementById('addr<xsl:value-of
> select="@id"/>Con').style.display='none';
> </xsl:if>
> </xsl:for-each>
>
> for (var hyI = 0; hyI < hyArgc; hyI++){
> document.getElementById(hyArgv[hyI]).style.display='';
> }
> }
>
> i have found that the above method is the best way of doing this (in
> firefox anyway) since i can never be sure of exactly how many panels
> will be drawn at runtime, due to the tabs being drawn (it's all a web
> front-end to an xml-driven piece of software).
>
> i also have a similar function that is used to clear the text fields i
> generate, and stick info into the appropriate field.
>
> thank you all for the suggestions, i know i'm dipping into javascript,
> but the javascript forums i've posted in so far have either left my
> post unanswered, or given me advice that completely breaks my attempt
> at simple cross-browser functionality.
>
> again thank you guys so much for the bits of help, and sorry if i'm
> going too far off topic
It is difficult when you have a problem which appears to cross technologies.
Another NG technique you could use is to cross post. That is address the
same message to both this xsl as well as the Javascript group. This allow
the message to be seen in both groups and replies in either group can be
seen by users in each.
Having looked at your problem I have to say that creating dynamic HTML is
something which should be avoided if at all possible. In this case I
believe it should be possible. Rather than having code that attempts to
reference specific IDs could you not enumerate the DOM looking for elements
that have IDs matching a pattern. E.g., any element ending in 'Bod',
'View', 'Sel' or 'Con'.
Anthony
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
