Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: testing a return value from msxsl:vbscript

From: "mblishch" <mblishch@-----.--->
To: 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



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent