Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Using XSLT parameters in a browser transform

From: "Robert Rossney" <rbr@----.--->
To: NULL
Date: 4/2/2004 1:06:00 PM
"David" <qwerty1234@m...> wrote in message
news:7bc493ab.0404020838.76b66b6a@p......
: I would like to be able to re-sort data in an HTML table on the
: without returning to the server.  It seems like an XSLT should be able
: to accomplish this, but I can't find enough information...

If you're using IE5.5 or later, this is pretty easy to do.

Here's a bit of DHTML I wrote to grab an RSS feed from a web site:

<html>
   <head>
      <title>BoardGameGeek Recent Additions</title>
      <link rel="stylesheet" type="text/css" href="rss_reader.css"/>
      <xml id="feed" src="http://www.boardgamegeek.com/feed.xml"
async="false"/>
      <xml id="transform" src="rss_reader.xsl"/>
  </head>
   <body
onload="document.body.innerHTML=document.all.feed.transformNode(document.all
.transform);">
   </body>
  </html>
   </head>
</html>

You can just load multiple transforms in the <head> and then write script
that applies the various transforms to your XML in a manner similar to the
way I'm doing it in the onload event handler.

You can also write script that passes parameters to the transform, but this
requires you to create an XSLTemplate object in script and manipulate it.
You might be better off "passing" the parameter by setting an attribute on
the document element of the XML, e.g.:

   onclick="document.all.feed.documentElement.setAttribute("sortOrder",
"someField"); document.all.mytable.innerHTML =
document.all.feed.transformNode(document.all.transform);"

I think it's probably wise to set the async attribute to "false" for all xml
elements in the page, though in this example it's not a problem because the
stylesheet is on the same server as the page, and the RSS feed isn't, so the
stylesheet is always loaded before the feed finishes loading.  But I don't
know how dependable that really is.

Hope this helps.

Bob Rossney
rbr@w...




transparent
Print
Mail
Digg
delicious
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