Subject: Re: [xsl] XSL template "namespace" problem From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 29 Mar 2006 14:37:58 -0500 |
... I know the Javascript is really a tier unto its own, and shouldn't be able to be processed via XSLT. I went through and tried some more examples, and embedded XSL code inside of HREFs weren't actually possible, but I was able to get modified Javascript calls via XSL through the <xsl:attribute> tag. Whether this is *proper* or not is, of course, up for debate, but xsltproc parsed it and gave output, so I assumed that it was proper. 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>
<A NAME="linkone"> <xsl:attribute name="HREF"> <xsl:text>javascript:process('linkone',</xsl:text> <xsl:value-of select='/rootnode/value'/> <xsl:text>)</xsl:text> </xsl:attribute> <xsl:text>Click me, value is: </xsl:text> <xsl:value-of select="/rootnode/value" /> <xsl:text>.</xsl:text> </A>
an A element is appended to the result tree a NAME attribute is appended to the A element a value of "linkone" is assigned to the @NAME an HREF attribute is appended to the A element a value is assigned text: "javascript:process('linkone'," the value of /rootnode/value text: ")" text is appended inside the A element: "Click me, value is: " next, the value of /rootnode/value is appended next, text is appended: "."
It literally produces the following output from xsltproc (of course, again, taken out of context.. I don't want to spam the list with code)
<A NAME="linkone" HREF="javascript:process('linkone',10)">Click me, value is: 10.</A>
(This is assuming that the XML file its using has a <rootnode><value>10</value></rootnode> entry.)
Its stuff like this that is confusing. Technically, I can never read ALL there is to know about XSLT while I'm learning, so I usually try examples to see if what I learned in theory can be applied on "real examples". I.E. stuff that I want to do with this type of technology. If xsltproc works, and IE works on what I've produced, there's nothing really telling me its "wrong". (Until, of course, I mention it on a mailing list like this one. :) )
Regardless, I really appreociate the time you guys have given me in replying with great ways to further my education in the field on the "right track". I'll follow as many of those links as possible, and look for other links regarding embedded Javascript or "how not to do it."
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" , Michael Kay | Thread | Re: [xsl] XSL template "namespace" , Ian Bonnycastle |
RE: [xsl] Filtering out duplicates , Don Smith | Date | RE: [xsl] XSL template "namespace" , Wendell Piez |
Month |