[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: junit test... for xslt2?

Subject: Re: junit test... for xslt2?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Sat, 6 Mar 2010 09:41:30 +0000
Re:  junit test... for xslt2?
> <!-- Integer compare -->
>  <xsl:function name="d:int-cmp" as="xs:boolean">
>    <xsl:param name="n1" as="xs:integer"/>
>    <xsl:param name="n2" as="xs:integer"/>
>    <xsl:choose>
>      <xsl:when test="$n1 = $n2">
>        <xsl:value-of select="true()"/>
>      </xsl:when>
>      <xsl:otherwise>
>        <xsl:value-of select="false()"/>
>      </xsl:otherwise>
>    </xsl:choose>
>  </xsl:function>

Out of interest, why would you want to use a function... what does
d:int-cmp($int1, $int2) give you over "$int1 eq $int2" ?

That aside, it's also worth using xsl:sequence rather than value-of to
return an atomic, to avoid the text node creation and atomisation.
And the choose can be compacted down to xsl:sequence select="$n1 eq
$n2".


--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.