Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: javascipt in xsl not working

From: "Anthony Jones" <Ant@------------.--->
To: 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 &lt; 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




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent