Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - testing a return value from msxsl:vbscript [Thread Next] Re: testing a return value from msxsl:vbscriptTo: NULL Date: 3/2/2005 6:25:00 AM I've played around the problem, look at my test files:
XML
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<main>
<rows val="0" />
<rows val="1" />
<rows val="2" />
<rows val="3" />
<rows val="4" />
<rows val="5" />
<rows val="6" />
<rows val="7" />
</main>
------------------------------------------------------------------
XSL
------------------------------------------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:my="urn:my-namespace">
<msxsl:script language="javascript" implements-prefix="my">
<![CDATA[
function funcSame( arg )
{
//type your code, but note that arg here has the type Object
//so it will be inconveniently to process it
return arg;
}
]]>
</msxsl:script>
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:template match="main">
<head>
<xsl:for-each select="rows">
<xsl:value-of select="@val" />
<xsl:choose>
<xsl:when test = " my:funcSame( @val ) = 5 " >
<r> value = 5 -> process1 </r>
</xsl:when>
<xsl:otherwise>
<r> value != 5 -> process2 </r>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</head>
</xsl:template>
</xsl:stylesheet>
--------------------------------------------------------------------------------------------------
You can compare function's results but note that use javascripts (or
vbscripts) so way is not recommended.
Best regargs
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
