[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to get the name of the current element?
Pierre, It's very easy. In your XSL, while processing the <p> tag in the output (ie: before the </p> tag), use the following: <xsl:attribute name="class"><xsl:eval>fnTagName(this)</xsl:eval></xsl:attribute> Then, at the top of the page, include a script block, like this: <xsl:script language = "javascript"><![CDATA[ function fnTagName(e) { return e.nodeName; } ]]></xsl:script> You'll find that this works even with the first MSXML parser. You could get even trickier and include the whole thing in the same xsl:eval tag, but I prefer to abstract the function so that it can be re-used. As a side note, if you want to do client side XML transformations, you don't have a great deal of choice other than IE5. In my opinion, they did a pretty good job on it, considering the timeframe. I've been able to do some amazing things in the user interface using XML and XSL in IE 5; things that I never would have though possible before. I don't know about the other UI developers out there using XML on the client, but I haven't been this excited about a technology in a long time. Although I may someday find something that is not possible, I haven't found it yet--at least I've been able to more than satisfy even the most extreme of customer requests. A determined developer can accomplish a lot if he or she believes that it's possible. Just remember that you can totally manipulate the DOM using script, or a combination of script and XSL. If there is something you need to do, and you think it can't be done, that usually means only that you haven't figured it out yet. For example, three of the MSXML extensions to the W3C DOM, selectNodes(), selectSingleNode() and transformNode() are incredibly useful for UI work. Regards, Mike Sharp Senior Site Developer Lante Corporation "Pierre, Sebastian" <spierre@R...> on 05/19/2000 06:19:17 PM To: Peter Armstrong <armstrong@e...> cc: XML-Dev ML <xml-dev@x...> (bcc: Mike Sharp/Lante) Subject: RE: How to get the name of the current element? You're completely true to say -MS-XML, because it is far from being XML ;) | No. I was assuming you were doing this server-side (e.g. with Cocoon). | Maybe one of the MS people on this list can help you--I don't know | anything about MSXML. | *************************************************************************** This is xml-dev, the mailing list for XML developers. To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev List archives are available at http://xml.org/archives/xml-dev/ ***************************************************************************
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|