|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] <xsl:eval> equivalent problem
Hi All,
?
I am upgrading an WD xsl stylesheet to use the http://www.w3.org/1999/XSL/Transform namespace and have run into some problems with finding an equivalent to <xsl:eval>.? More specifically, I'm trying to find a way to pass parameters into jscript and vbscript functions that were in xsl:eval blocks.? The document currently contains an xsl:eval block that defining the variables for use throughout the xsl:
?
??????????????????????? <xsl:stylesheet
?????? ???????????????? ?xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
?????? ???????????????? ?xmlns:dav="DAV:"?
?????? ???????????????? ?xmlns:f="urn:schemas-microsoft-com:publishing:"
?????? ???????????????? ?xmlns:office="urn:schemas-microsoft-com:office:office">
?
??? ??????????????????? <xsl:template match="/">
??? ???????
<xsl:eval>
??????????????????????????????????? var g_strDavNS = getNamespaceUsedInXml(this, "DAV:");
??????????????????????????????????? var g_dataURL = this.selectSingleNode("/" + g_strDavNS + ":multistatus/dataURL").text;
??????????????????????????????????? var g_desc = this.xml;
??????????????????????? </xsl:eval>
?
Followed by quite a bit of xsl processing with periodic reference to these variables throughout:
ie.
. dataurl=<xsl:eval>g_dataURL;</xsl:eval>
and
<xsl:eval>getDesc(g_desc);</xsl:eval>
?
followed by a large script section:
?
<xsl:script language="vbscript">
??????????? <![CDATA[
??????????? Function GetIt(value, name)
??????????????????????? name = value
??????????????????????? GetIt=""
??????????? End Function
??????????? Function getHTMLMain(dModified, dCreate)
??????????????????????? if dCreate = "" then
??????????????????????????????????? dCreate=dModified
??????????????????????? end if
??????????????????????? iDiff = DateDiff("d",now(),dCreate)
??????????????????????? if abs(iDiff) < 3 then
??????????????????????????????????? getHTMLMain = getHTML()
??????????????????????????????????? exit function
??????????????????????? else
??????????????????????????????????? iDiff=DateDiff("d",now(), dModified)
??????????????????????????????????? if abs(iDiff) < 3 then
??????????????????????????????????????????????? getHTMLMain = getHTML()
??????????????????????????????????????????????? exit function
??????????????????????????????????? end if
??????????????????????? end if
??????????????????????? getHTMLMain = ""
??????????? end function
???????????
??????????? function getHTML()
??????????????????????? getHTML = "<img src='_WPR_/newlink.gif' border='0'/>"
??????????? End function
]]>
</xsl:script>
<xsl:script language="JScript">
??????????? <![CDATA[
???????????
??????????? function getDesc(sDesc)
??????????? {
??????????????????????? if(sDesc.length > 50)
??????????????????????????????????? return? sDesc;
??????????????????????? else
??????????????????????????????????? return sDesc;
??????????? }
???????????
??? function getNamespaceUsedInXml(nodItem, strNamespace)
{
??????????? if (!nodItem)
??????????? {
??????????????????????? return "";
??????????? }
?
??????????? var nodOwnerDocument = null;
??????????? if (9 == nodItem.nodeType)
??????????? {
??????????????????????? // What we were handed was actually the root document node and not a regular node.
??????????????????????? nodOwnerDocument = nodItem;
??????????? }
??????????? else
??????????? {
??????????????????????? // We were handed a regular node. Get the root document node.
??????????????????????? nodOwnerDocument = nodItem.ownerDocument;
??????????? }
??????????? .......more script here......
?
??????????? return strShortNamespace;
}
]]>
??????????? </xsl:script>
</xsl:stylesheet>
?
It seems as though I could create <xsl:variable> for the three jscript/vbscript specified variables above but I'm not sure how I would pass an equivalent "this" parameter.? I know the xsl:script tags are not supported either and am wondering if the approach of setting an xsl:variable to a script call is even possible.
?
Hope this makes sense.? Thanks in advance,
Chris
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








