Subject: attribute value templates & javascript entities, etc From: Jim Palmer <jpalmer@xxxxxxxxxxxx> Date: Sun, 27 Jun 1999 12:27:36 -0700 |
Sorry if this is obvious, but I looked in the archives for a solution and didn't see it. Thanks in advance. -- Jim Palmer Manager, Human Interface Liberate Technologies, Inc. 650-631-5237 http://www.liberate.com ---------------------------------------------------------------------------------------------------- Problem 1: Imagine you need an HTML attribute such as BACKGROUND to be computed in a page's run time context. So I want to use a javascript entity in the final HTML (though javascript is not essential to the problem): <BODY BACKGROUND="&{backgroundUrl}" ... > The following naive solution doesn't work <xsl:template match="/"> <HTML> <HEAD> <TITLE></TITLE> <SCRIPT> var backgroundUrl = foo(); </SCRIPT> </HEAD> <BODY background = "&{backgroundUrl};"> Whatever </BODY> </HTML> </xsl:template> presumably since "&" isn't in the HTML name space except for HTML entities (such as &) and "{}" are for attribute value templates in xsl. Is there some obvious way to get the literal text in there (xsl:constant?). Variant: Lets say the some part of the body HTML needs to be decided at run time; I have no problem in general including javascript in the output (or any other elements not in the HTML namespace) -- they come out fine -- _except_ when I have to document.write the HTML (I understand that this may be impossible due to nested quoting, etc.) -- the xsl continues to try to parse the HTML. Assume that all the HTML tags do match: <xsl:template match="/"> <HTML> <HEAD> <TITLE></TITLE> <SCRIPT> var fullScreen = foo(); </SCRIPT> </HEAD> <BODY> <SCRIPT> if (fullScreen) document.write( '<FORM NAME="buttons" />', '<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" />', '<TR>', '<TD><SPACER TYPE="horizontal" SIZE="12" /></TD>', ... ) else document.write( .... ) </SCRIPT> </BODY> </HTML> </xsl:template> I invariably get "tags don't match" type errors, even though they do. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: The XSL-List Digest V2 #191, Paul Prescod | Thread | RE: attribute value templates & jav, Kay Michael |
RE: XSLT vs JSP, Steven Marcus | Date | Do we all work on Sundays?, KAREN_LEICHEL |
Month |