OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: How to get the name of the current element?

[ Lists Home | Date Index | Thread Index ]
  • From: "Mike Sharp" <msharp@lante.com>
  • To: "Pierre, Sebastian" <spierre@Rational.Com>
  • Date: Sat, 20 May 2000 12:28:04 -0700



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@Rational.Com> on 05/19/2000 06:19:17 PM

To:   Peter Armstrong <armstrong@exoffice.com>
cc:   XML-Dev ML <xml-dev@xml.org> (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@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS