Subject: RE: [xsl] XSL template "namespace" problem From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 29 Mar 2006 14:49:12 -0500 |
<A NAME="linkone"><xsl:attribute name="HREF">javascript:process('linkone',<xsl:value-of select='/rootnode/value'/>)</xsl:attribute>Click me, value is: <xsl:value-of select="/rootnode/value" />.</A>
(Notice the <xsl:value-of> tag inside the Javascript call inside the A HREF, and inside the A HREF data field.)
This is now well-formed (though not very pretty) XML, and it's correct XSLT. The HTML it generates is slightly dubious, because javascript:process(.....) is not a legal URL, so some HTML validators may get upset about it (and the XSLT serializer will replace spaces by %20, which would probably stop it working); you may be better off generating attributes like onClick that are designed to hold Javascript rather than URLs.
This is all well and good, but then that means that there is no way to create javascript-linked links in XSLT. The reason I'm doing it this way is because I'm trying to create a menu system that is based on an XML file to define its content. Unfourtunately, using a structure like:
<A OnClick="funccall()">Some text</A>
doesn't create a clickable link, even though it might be more "well formed" than:
<A HREF="javascript:funccall()">Some text</A>
This latter code actually creates a link that one can click on.
From what I'm understanding, this type of structure, because its not well formed, is completely incompatible with XSLT, even thought xsltproc processes it properly and IE interprets it correctly.
I guess I'm a little confused why these browsers and processors are interpreting it if its technically illegal.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL template "namespace" , Wendell Piez | Thread | [xsl] XSL 1.1 -> Asking for an attr, news |
Re: [xsl] XSL template "namespace" , Wendell Piez | Date | Re: [xsl] XSL template "namespace" , Wendell Piez |
Month |