Subject: RE: xsl:script and Xalan ? From: "Philippe D'Hont" <philippe.dhont@xxxxxxxx> Date: Fri, 16 Jun 2000 10:20:19 +0200 |
Hi, Thanks for your reply, but the my script as to be processed by the XSL parser (XALAN for me). Here follow a part of my original XSL file : ---------------------------------------------------------------------------- ---------- <xsl:template match="text"> <xsl:if test="@tts[.='true']"> <SCRIPT> AddString('<xsl:eval>Filter(this)</xsl:eval>'); </SCRIPT> </xsl:if> <xsl:choose> <xsl:when test="@visible[.='false']"> <!-- Do nothing --> </xsl:when> <xsl:when expr="wasLeft"> <TD> <SPAN CLASS="text"> <xsl:apply-templates/> </SPAN> </TD> <SCRIPT LANGUAGE="JavaScript"> document.write(ltchar + "/TR" + gtchar); document.write(ltchar + "/TABLE" + gtchar); </SCRIPT> <xsl:script language="JavaScript"> wasLeft = false; </xsl:script> </xsl:when> <xsl:otherwise> <SPAN CLASS="text"> <xsl:apply-templates/> </SPAN> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="image"> <xsl:choose> <xsl:when test="@position[.='left']"> <xsl:script language="JavaScript"> wasLeft = true; </xsl:script> <SCRIPT LANGUAGE="JavaScript"> document.write(ltchar + "TABLE" + gtchar); document.write(ltchar + "TR" + gtchar); </SCRIPT> <TD> <SPAN CLASS="image"> <IMG BORDER="0"> <xsl:attribute name="SRC"> <xsl:value-of select="@file"/> </xsl:attribute> <xsl:if test="area"> <xsl:attribute name="USEMAP">#map-<xsl:value-of select="@file"/></xsl:attribute> </xsl:if> </IMG> <!--SPAN ID="mapDescArea"> <xsl:value-of select="text"/> </SPAN--> <!-- Define map and areas, if one --> <xsl:if test="area"> <MAP> <xsl:attribute name="NAME">map-<xsl:value-of select="@file"/></xsl:attribute> <xsl:apply-templates select="area"/> </MAP> </xsl:if> <xsl:choose> <xsl:when test="@visible[.='false']"> <!-- Do nothing --> </xsl:when> <xsl:otherwise> <BR/> <xsl:value-of select="text"/> </xsl:otherwise> </xsl:choose> <xsl:if test="click"> <xsl:apply-templates select="click"/> </xsl:if> </SPAN> </TD> </xsl:when> <xsl:otherwise> <SPAN CLASS="image"> <IMG> <xsl:attribute name="SRC"> <xsl:value-of select="@file"/> </xsl:attribute> <xsl:if test="area"> <xsl:attribute name="USEMAP">#map-<xsl:value-of select="@file"/></xsl:attribute> </xsl:if> </IMG> <xsl:if test="area"> <MAP> <xsl:attribute name="NAME">map-<xsl:value-of select="@file"/></xsl:attribute> <xsl:apply-templates select="area"/> </MAP> </xsl:if> <xsl:choose> <xsl:when test="@visible[.='false']"> <!-- Do nothing --> </xsl:when> <xsl:otherwise> <BR/> <xsl:value-of/> </xsl:otherwise> </xsl:choose> <xsl:if test="click"> <xsl:apply-templates select="click"/> </xsl:if> </SPAN> </xsl:otherwise> </xsl:choose> <xsl:if test="@tts[.='true']"> <SCRIPT> AddString('<xsl:value-of select="@description"/>'); </SCRIPT> </xsl:if> </xsl:template> ---------------------------------------------------------------------------- ---------- So my problem is with the wasLeft variable. I have tried to replace the xsl:script statement with the declaration of a xsl:variable, but it doesn't work I tried like this.. // Declaration <xsl:variable name="wasLeft" select="0"/> // Test : <xsl:when test="wasLeft=1"> and <xsl:when test="$wasLeft=1"> But it doesn't work. Anyone who had a suggestion is welcome. Kinds Regards D'Hont Philippe. -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Warren Hedley Sent: donderdag 15 juni 2000 19:14 To: xsl-list@xxxxxxxxxxxxxxxx Subject: Re: xsl:script and Xalan ? Philippe D'Hont wrote: > > My question is there is something similar to <xsl:script> > that I can use with Xalan ? With any XSLT-conforming app, you can just use <xsl:text> and wrap your script in a <![CDATA[]]> section, which means you don't manually have to escape everything. This works for me: <script type="text/javascript"> <xsl:text><![CDATA[ //<!-- hide javascript from older browsers function func(num) { for (i=0;i<oSub.length;i++) { other_func(i); } } //--> ]]></xsl:text> </script> -- Warren Hedley XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: xsl:script and Xalan ?, Warren Hedley | Thread | Re: xsl:script and Xalan ?, Warren Hedley |
RE: encoding="iso-8859-1", Stéphane Mamdy | Date | RE: differentiation between text() , Kay Michael |
Month |