[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSL template "namespace" problem

Subject: RE: XSL template "namespace" problem
From: Ian Bonnycastle <ibonny@xxxxxxxxxxxx>
Date: Wed, 29 Mar 2006 13:31:08 -0500 (EST)
RE:  XSL template "namespace" problem
On Wed, 29 Mar 2006, Michael Kay wrote:

One
snippet of XSLT code I'm using as an example is:

<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.

Ian

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.